|
1 | 1 | import { html, css } from '@webjskit/core'; |
2 | 2 | import { loadRegistryIndex } from '../_lib/registry.server.ts'; |
| 3 | +import { splitByTier } from '../_lib/tier.ts'; |
3 | 4 |
|
4 | 5 | // Subtle, hover-revealed scrollbar for the sidenav. |
5 | 6 | // |
@@ -49,6 +50,7 @@ const SIDENAV_STYLES = css` |
49 | 50 | export default async function DocsLayout({ children }: { children: unknown }) { |
50 | 51 | const all = await loadRegistryIndex(); |
51 | 52 | const components = all.filter((i) => i.type === 'registry:ui'); |
| 53 | + const { tier1, tier2 } = splitByTier(components); |
52 | 54 |
|
53 | 55 | // Shared link styling: padded, rounded, with a clearly visible hover |
54 | 56 | // surface. `-mx-2` lets the rounded hover background extend slightly |
@@ -98,9 +100,21 @@ export default async function DocsLayout({ children }: { children: unknown }) { |
98 | 100 | <a href="/docs" class=${linkClass}>Introduction</a> |
99 | 101 | <a href="/" class=${linkClass}>All components</a> |
100 | 102 | </nav> |
101 | | - <div class="font-semibold mb-2 text-fg">Components <span class="font-normal text-xs text-fg-subtle">(${components.length})</span></div> |
| 103 | + <div class="flex items-baseline justify-between mb-2"> |
| 104 | + <div class="font-semibold text-fg">Tier 1 <span class="font-normal text-xs text-fg-subtle">Class helpers</span></div> |
| 105 | + <span class="text-xs text-fg-subtle">${tier1.length}</span> |
| 106 | + </div> |
| 107 | + <nav class="flex flex-col gap-0.5 mb-6"> |
| 108 | + ${tier1.map( |
| 109 | + (c) => html`<a href="/docs/components/${c.name}" class=${linkClass}>${c.name}</a>`, |
| 110 | + )} |
| 111 | + </nav> |
| 112 | + <div class="flex items-baseline justify-between mb-2"> |
| 113 | + <div class="font-semibold text-fg">Tier 2 <span class="font-normal text-xs text-fg-subtle">Custom elements</span></div> |
| 114 | + <span class="text-xs text-fg-subtle">${tier2.length}</span> |
| 115 | + </div> |
102 | 116 | <nav class="flex flex-col gap-0.5"> |
103 | | - ${components.map( |
| 117 | + ${tier2.map( |
104 | 118 | (c) => html`<a href="/docs/components/${c.name}" class=${linkClass}>${c.name}</a>`, |
105 | 119 | )} |
106 | 120 | </nav> |
|
0 commit comments