forked from denoland/fresh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDocsSidebar.tsx
More file actions
45 lines (41 loc) · 1.13 KB
/
DocsSidebar.tsx
File metadata and controls
45 lines (41 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import type {
TableOfContentsCategory,
TableOfContentsCategoryEntry,
} from "../data/docs.ts";
export function SidebarCategory(props: {
category: TableOfContentsCategory;
}) {
const { title, href, entries } = props.category;
return (
<li class="my-2 block">
<a
href={href}
class="text-foreground-secondary hover:text-gray-600 aria-[current]:text-fresh-green aria-[current]:hover:underline font-bold"
>
{title}
</a>
{entries.length > 0 && (
<ul class="py-2 nested list-outside">
{entries.map((entry) => (
<SidebarEntry key={entry.href} entry={entry} />
))}
</ul>
)}
</li>
);
}
export function SidebarEntry(props: {
entry: TableOfContentsCategoryEntry;
}) {
const { title, href } = props.entry;
return (
<li class="py-[1px]">
<a
href={href}
class="aria-[current]:text-fresh-green aria-[current]:border-green-600 aria-[current]:bg-fresh-green/5 border-l-4 border-transparent px-4 py-0.5 transition-colors hover:text-fresh-green/80 font-normal block"
>
{title}
</a>
</li>
);
}