import { Card, CardContent, CardFooter } from '@/components/card'; import { CbarLogo } from '../brand/logo'; import { ErrorBoundary } from '~/chrome/ui/error-boundary'; import { useGroupLabel, useLang, useMessages } from '../i18n'; import { entries, groupedEntries } from '../registry'; import type { Entry } from '../registry/types'; import { Link } from '../router'; /** * What to draw on a card. * * An entry with axes renders itself at its defaults. The overlays and the data * widgets have no single default instance — a closed Dialog is an empty box — * so they fall back to their first composition, clipped to card height. */ function preview(entry: Entry) { if (entry.render) return entry.render({ ...entry.defaults }); return entry.compositions?.[0]?.render() ?? null; } /** * Every component on one page. * * Storybook can only show you one story at a time; this is the view that * answers "what is actually in this kit" in a single scroll. Each card renders * the real component at its defaults and links to its own page. */ export function OverviewPage() { const m = useMessages(); const [lang] = useLang(); const groupLabel = useGroupLabel(); return (
{/* The band CBAR opens its own documentation with — brand fill, a radius on the trailing corners, the thumbnail's discs off to the right. */}

{m.nav.brandCaption}

{m.overview.lead(entries.length)}

{groupedEntries.map(([group, items]) => (

{groupLabel(group)}

{/* The kit's own Card, with its vertical padding zeroed: the preview is a bleed, so it owns the top of the surface. The Card is still a div and not a link — several previews (Breadcrumb, Pagination) render real anchors and an may not contain another one. Only the name is the link. */} {items.map((entry) => ( {/* Forty components render live on this one page, so it is the place a broken one does the most damage: without a wall per card, one throw is a blank site. */} {preview(entry)} {entry.name} ))}
))}
); }