Skip to content

Commit

Permalink
v3 docs: Remove request handling API (#1291)
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper authored Dec 7, 2023
1 parent 0550c62 commit 2d998a5
Show file tree
Hide file tree
Showing 88 changed files with 1,288 additions and 999 deletions.
28 changes: 28 additions & 0 deletions documentation-v3/src/components/Head.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
interface Props {
title: string;
}
---
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<title>{Astro.props.title}</title>

<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@lucia_auth" />
<meta name="twitter:title" content={Astro.props.title} />
<meta
name="twitter:description"
content="Lucia is an open source auth library that abstracts away the complexity of handling sessions."
/>
<!-- <meta property="og:image" content="" /> -->

<meta property="og:site_name" content="Lucia" />
<meta property="og:title" content={Astro.props.title} />
<meta property="og:url" content="https://v3.lucia-auth.com" />
<meta
property="og:description"
content="Lucia is an open source auth library that abstracts away the complexity of handling sessions."
/>
</head>
61 changes: 61 additions & 0 deletions documentation-v3/src/components/NavMenu.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
interface Props {
sections: Section[];
}
export interface Section {
title: string;
pages: Page[];
}
export type Page = [title: string, href: string];
function isSelected(href: string, currentPathname: string): boolean {
if (removeLeadingSlash(href) === removeLeadingSlash(currentPathname)) {
return true;
}
return currentPathname.startsWith(removeLeadingSlash(href) + "/");
}
function removeLeadingSlash(s: string): string {
if (s.endsWith("/")) {
return s.split("/").slice(0, -1).join("/");
}
return s;
}
---

<ul class="text-sm">
{
Astro.props.sections.map((section) => {
if (section.pages.length < 1) {
return null
}
return (
<li class="mt-6">
<p class="mb-1 text-sm font-medium">{section.title}</p>
<ul>
{section.pages.map((page) => {
return (
<li class="my-1">
<a
class:list={[
"hover:underline",
{
"text-zinc-600": !isSelected(page[1], Astro.url.pathname),
"text-main": isSelected(page[1], Astro.url.pathname)
}
]}
href={page[1]}
>
{page[0]}
</a>
</li>
);
})}
</ul>
</li>
);
})
}
</ul>
93 changes: 0 additions & 93 deletions documentation-v3/src/components/nav-menus/MainNavMenu.astro

This file was deleted.

19 changes: 0 additions & 19 deletions documentation-v3/src/components/nav-menus/shared.ts

This file was deleted.

58 changes: 58 additions & 0 deletions documentation-v3/src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
import Head from "@components/Head.astro";
import NavMenu from "@components/NavMenu.astro";
import type { Section } from "@components/NavMenu.astro";
interface Props {
title: string;
sections: Section[];
}
---

<html lang="en">
<Head title={Astro.props.title} />
<body class="text-zinc-900 leading-relaxed">
<main class="w-full md:px-4">
<nav class="md:hidden w-full fixed border-b bg-white pt-3 pb-2 max-h-screen flex flex-col">
<header class="flex place-items-center place-content-between px-4">
<a href="/" class="font-medium text-xl">Lucia</a>
<button id="nav-button">Open</button>
</header>
<div class="px-4 overflow-auto overscroll-contain hidden pb-4" id="mobile-nav-menu">
<NavMenu sections={Astro.props.sections}/>
</div>
</nav>
<div class="max-w-5xl mx-auto w-full px-4 md:px-0">
<div class="fixed w-60 shrink-0 hidden md:block h-screen pt-8 pr-4">
<a href="/" class="font-medium text-2xl">Lucia</a>
<div class="overflow-auto h-full pb-24">
<NavMenu sections={Astro.props.sections}/>
</div>
</div>
<div class="md:ml-60 pt-20 md:pt-12 pb-24">
<slot />
</div>
</div>
</main>
</body><style>
:root {
--astro-code-color-background: rgb(246, 246, 246);
--astro-code-token-keyword: rgb(235, 72, 105);
--astro-code-token-string-expression: rgb(77, 102, 183);
--astro-code-token-comment: rgb(175, 175, 175);
}
</style>

<script>
document.getElementById("nav-button")!.addEventListener("click", (e) => {
const navMenu = document.getElementById("mobile-nav-menu")!;
if (navMenu.classList.contains("hidden")) {
navMenu.classList.remove("hidden");
} else {
navMenu.classList.add("hidden");
}
});
</script>
</html>
10 changes: 5 additions & 5 deletions documentation-v3/src/layouts/DocLayout.astro
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
import MarkdownArticle from "src/components/MarkdownArticle.astro";
import MainLayout from "./MainLayout.astro";
import type { MarkdownLayoutProps } from "astro";
import MainLayout from "./MainLayout.astro";
type Props = MarkdownLayoutProps<{
title: string;
}>;
---

<MainLayout title={Astro.props.frontmatter.title}>
<h1 class="text-4xl font-semibold mb-4">{Astro.props.frontmatter.title}</h1>
<MarkdownArticle>
<slot />
</MarkdownArticle>
<h1 class="text-4xl font-semibold mb-4">{Astro.props.frontmatter.title}</h1>
<MarkdownArticle>
<slot />
</MarkdownArticle>
</MainLayout>
Loading

0 comments on commit 2d998a5

Please sign in to comment.