-
-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mobile support to v2 docs (#767)
- Loading branch information
1 parent
dc25093
commit b923e03
Showing
12 changed files
with
258 additions
and
129 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,68 @@ | ||
<header | ||
class="w-full py-3 px-8 fixed top-0 border-b bg-white z-30 flex place-items-center gap-x-16" | ||
> | ||
<a class="pointer-events-auto flex place-items-center" href="/"> | ||
<img | ||
src="/logo.svg" | ||
alt="Lucia logo" | ||
width="100" | ||
height="100" | ||
class="h-5 w-5" | ||
/> | ||
<p class="text-xl font-bold">Lucia</p> | ||
</a> | ||
<div class="flex gap-x-10 place-items-center text-sm font-medium"> | ||
<a href="/reference" class="hover:text-main">Reference</a> | ||
<a href="/oauth" class="hover:text-main">OAuth</a> | ||
--- | ||
import MenuIcon from "@icons/MenuIcon.astro"; | ||
import MoreIcon from "@icons/MoreIcon.astro"; | ||
--- | ||
|
||
<header class="w-full fixed top-0 bg-white z-30"> | ||
<div | ||
class="flex place-items-center place-content-between sm:place-content-start gap-x-16 py-3 border-b px-4 sm:px-8" | ||
> | ||
<a class="pointer-events-auto flex place-items-center" href="/"> | ||
<img | ||
src="/logo.svg" | ||
alt="Lucia logo" | ||
width="100" | ||
height="100" | ||
class="h-5 w-5" | ||
/> | ||
<p class="text-xl font-bold">Lucia</p> | ||
</a> | ||
<div | ||
class="gap-x-10 place-items-center text-sm font-medium hidden sm:flex" | ||
> | ||
<a href="/reference" class="hover:text-main">Reference</a> | ||
<a href="/oauth" class="hover:text-main">OAuth</a> | ||
</div> | ||
<div class="sm:hidden"> | ||
<button class="p-1 rounded block hover:bg-indigo-50" id="more-button"> | ||
<div class="w-5 h-5 fill-current"> | ||
<MoreIcon /> | ||
</div> | ||
</button> | ||
<div class="absolute right-0 mr-4 bg-white rounded border text-sm font-medium py-2 w-36 shadow hidden sm:hidden" id="more-dropdown"> | ||
<a href="/reference" class="hover:bg-indigo-50 block px-4 py-1.5">Reference</a> | ||
<a href="/oauth" class="hover:bg-indigo-50 block px-4 py-1.5">OAuth</a> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="lg:hidden px-4 sm:px-8 py-1.5 border-b"> | ||
<button class="p-1 rounded block hover:bg-indigo-50" id="menu-button"> | ||
<div class="w-5 h-5 fill-current"> | ||
<MenuIcon /> | ||
</div> | ||
</button> | ||
</div> | ||
</header> | ||
<script> | ||
import { onMoreToggle, toggleMore , toggleMenu} from "@utils/state"; | ||
const menuButton = document.getElementById("menu-button"); | ||
const moreButton = document.getElementById("more-button") | ||
if (menuButton instanceof HTMLButtonElement) { | ||
menuButton.addEventListener("click", toggleMenu); | ||
} | ||
if (moreButton instanceof HTMLButtonElement) { | ||
moreButton.addEventListener("click", toggleMore); | ||
} | ||
|
||
const moreDropdownDiv = document.getElementById("more-dropdown") | ||
if (moreDropdownDiv instanceof HTMLDivElement) { | ||
onMoreToggle((dropdownOpened) => { | ||
if (dropdownOpened) { | ||
moreDropdownDiv.classList.remove("hidden"); | ||
} else { | ||
moreDropdownDiv.classList.add("hidden"); | ||
} | ||
}); | ||
} | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
--- | ||
import type { SubCollection } from "@content"; | ||
type Props = { | ||
collectionId: string; | ||
subCollections: SubCollection[]; | ||
title?: string; | ||
}; | ||
--- | ||
|
||
<div | ||
class="h-screen fixed left-0 top-0 border-r hidden lg:block lg:w-72 bg-white pt-24 lg:pt-16 w-full" | ||
id="menu" | ||
> | ||
<input type="hidden" value={Astro.props.collectionId} id="collection-id" /> | ||
{ | ||
Astro.props.title && ( | ||
<p class=" ml-8 font-semibold">{Astro.props.title}</p> | ||
) | ||
} | ||
<div | ||
class="overflow-auto h-full overscroll-contain pt-2 text-sm" | ||
id="content-nav" | ||
> | ||
<slot /> | ||
{ | ||
Astro.props.subCollections.map((subCollection) => { | ||
return ( | ||
<div class="mb-6"> | ||
<p class="ml-8 text-sm font-medium text-zinc-400"> | ||
{subCollection.title} | ||
</p> | ||
<ul class="mt-0.5"> | ||
{subCollection.pages | ||
.filter((page) => !page.hidden) | ||
.map((page) => { | ||
const urlPathname = [ | ||
"", | ||
...page.pathname | ||
.split("/") | ||
.filter((segment, i) => { | ||
return ( | ||
i !== 0 || | ||
segment !== "main" | ||
); | ||
}) | ||
].join("/"); | ||
const selected = | ||
Astro.url.pathname.split("/").length >= | ||
page.pathname.split("/").length && | ||
Astro.url.pathname.includes( | ||
urlPathname | ||
); | ||
return ( | ||
<li> | ||
<a | ||
href={urlPathname} | ||
class:list={[ | ||
"w-full py-1 pl-8 hover:bg-indigo-50 block", | ||
{ | ||
"bg-gray-100": selected | ||
} | ||
]} | ||
set:html={page.htmlTitle} | ||
/> | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
</div> | ||
); | ||
}) | ||
} | ||
</div> | ||
</div> | ||
<script is:inline> | ||
const contentNavigationElement = document.getElementById("content-nav"); | ||
const collectionIdElement = document.getElementById("collection-id"); | ||
if ( | ||
contentNavigationElement instanceof HTMLDivElement && | ||
collectionIdElement instanceof HTMLInputElement | ||
) { | ||
const collectionId = collectionIdElement.value; | ||
const storedScrollPosition = sessionStorage.getItem("scroll_position"); | ||
if (storedScrollPosition !== null) { | ||
const [prevCollectionId, prevScrollPosition] = | ||
storedScrollPosition.split(":"); | ||
if (prevCollectionId === collectionId) { | ||
contentNavigationElement.scrollTop = Number(prevScrollPosition); | ||
} | ||
} | ||
contentNavigationElement.addEventListener("click", () => { | ||
sessionStorage.setItem( | ||
`scroll_position`, | ||
`${collectionId}:${contentNavigationElement.scrollTop.toString()}` | ||
); | ||
}); | ||
} | ||
</script> | ||
<script> | ||
import { onMenuToggle } from "@utils/state"; | ||
|
||
const menuDiv = document.getElementById("menu"); | ||
if (menuDiv instanceof HTMLDivElement) { | ||
onMenuToggle((menuOpened) => { | ||
if (menuOpened) { | ||
menuDiv.classList.remove("hidden"); | ||
} else { | ||
menuDiv.classList.add("hidden"); | ||
} | ||
}); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
viewBox="0 -960 960 960" | ||
><path | ||
d="M150-240q-12.75 0-21.375-8.675-8.625-8.676-8.625-21.5 0-12.825 8.625-21.325T150-300h660q12.75 0 21.375 8.675 8.625 8.676 8.625 21.5 0 12.825-8.625 21.325T810-240H150Zm0-210q-12.75 0-21.375-8.675-8.625-8.676-8.625-21.5 0-12.825 8.625-21.325T150-510h660q12.75 0 21.375 8.675 8.625 8.676 8.625 21.5 0 12.825-8.625 21.325T810-450H150Zm0-210q-12.75 0-21.375-8.675-8.625-8.676-8.625-21.5 0-12.825 8.625-21.325T150-720h660q12.75 0 21.375 8.675 8.625 8.676 8.625 21.5 0 12.825-8.625 21.325T810-660H150Z" | ||
></path> | ||
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<svg xmlns="http://www.w3.org/2000/svg" class="w-full h-full"> | ||
<circle cx="20%" cy="50%" r="1.75"></circle> | ||
<circle cx="50%" cy="50%" r="1.75"></circle> | ||
<circle cx="80%" cy="50%" r="1.75"></circle> | ||
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
b923e03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
lucia – ./documentation
lucia-git-main-pilcrowonpaper.vercel.app
lucia-auth.vercel.app
lucia-auth.com
lucia-sveltekit.vercel.app
lucia-pilcrowonpaper.vercel.app
www.lucia-auth.com