Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions docs-app/components/WikiNavIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Sidebar icon names follow wiki slugs, not display titles (which can vary by version).
const ICONS: Record<string, string> = {
'': 'overview',
'bar-chart': 'bar',
'heatmap-chart': 'heatmap',
'histogram-chart': 'histogram',
'line-chart': 'line',
'pie-chart': 'pie',
'radar-chart': 'radar',
'ring-gauge-chart': 'ring-gauge',
'scatter-chart': 'scatter',
'segmented-ring-gauge-chart': 'segmented-ring',
'stacked-area-chart': 'stacked-area',
'stacked-bar-chart': 'stacked-bar',
customization: 'customization',
gradients: 'gradients',
migration: 'migration',
screenshots: 'screenshots',
};

export function WikiNavIcon({ slug, active }: { slug: string; active: boolean }) {
const icon = ICONS[slug] ?? 'document';

return (
<svg
aria-hidden="true"
focusable="false"
viewBox="0 0 24 24"
className={`h-[18px] w-[18px] shrink-0 ${active ? 'text-[var(--color-primary)]' : 'text-[var(--text-muted)]'}`}
fill="none"
stroke="currentColor"
strokeWidth="1.7"
strokeLinecap="round"
strokeLinejoin="round"
>
<use href={`/wiki-nav-icons.svg#${icon}`} />
</svg>
);
}
6 changes: 5 additions & 1 deletion docs-app/components/WikiSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { useRef } from 'react';
import { WikiNavIcon } from './WikiNavIcon';
import type { NavItem } from '@/lib/types';
import { useScrollActiveIntoView } from '@/lib/use-scroll-active-into-view';
import { cn, stickySidebar } from '@/lib/utils';
Expand Down Expand Up @@ -44,7 +45,10 @@ export function WikiSidebar({ navigation }: WikiSidebarProps) {
)}
aria-current={isActive(item.path) ? 'page' : undefined}
>
{item.title}
<span className="flex min-w-0 items-center gap-2.5">
<WikiNavIcon slug={item.slug} active={isActive(item.path)} />
<span className="min-w-0">{item.title}</span>
</span>
{item.badgeCount ? (
<span className="rounded-full bg-[var(--color-warning)] px-1.5 py-0.5 text-[10px] font-semibold leading-none text-[var(--bg-primary)]">
{item.badgeCount}
Expand Down
82 changes: 82 additions & 0 deletions docs-app/public/wiki-nav-icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.