Skip to content

Commit 542e638

Browse files
committed
feat(ui-website): split docs sidenav components list by tier
Sidenav now renders two grouped sections — 'Tier 1 · Class helpers' (20 components) and 'Tier 2 · Custom elements' (12 components) — with per-section counts. Each section's items are alphabetical within the tier. Uses the splitByTier() helper from f2ba5c4.
1 parent 7a7fc2b commit 542e638

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

  • packages/ui/packages/website/app/docs

packages/ui/packages/website/app/docs/layout.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { html, css } from '@webjskit/core';
22
import { loadRegistryIndex } from '../_lib/registry.server.ts';
3+
import { splitByTier } from '../_lib/tier.ts';
34

45
// Subtle, hover-revealed scrollbar for the sidenav.
56
//
@@ -49,6 +50,7 @@ const SIDENAV_STYLES = css`
4950
export default async function DocsLayout({ children }: { children: unknown }) {
5051
const all = await loadRegistryIndex();
5152
const components = all.filter((i) => i.type === 'registry:ui');
53+
const { tier1, tier2 } = splitByTier(components);
5254

5355
// Shared link styling: padded, rounded, with a clearly visible hover
5456
// surface. `-mx-2` lets the rounded hover background extend slightly
@@ -98,9 +100,21 @@ export default async function DocsLayout({ children }: { children: unknown }) {
98100
<a href="/docs" class=${linkClass}>Introduction</a>
99101
<a href="/" class=${linkClass}>All components</a>
100102
</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>
102116
<nav class="flex flex-col gap-0.5">
103-
${components.map(
117+
${tier2.map(
104118
(c) => html`<a href="/docs/components/${c.name}" class=${linkClass}>${c.name}</a>`,
105119
)}
106120
</nav>

0 commit comments

Comments
 (0)