import { playgroundParameters } from "@charcuterie/storybook-config/story-parameters"
import type { Meta, StoryObj } from "@storybook/react"
import { type ReactNode, useState } from "react"
import {
ContainerBoard,
StoryCell,
StoryGrid,
StorySection,
} from "../board.storyHelpers.tsx"
import { RouterLinkProvider } from "../RouterLink/RouterLinkProvider.tsx"
import type { RouterLinkProps } from "../RouterLink/routerLink.ts"
import type { BreadcrumbItem } from "./Breadcrumbs.tsx"
import { Breadcrumbs } from "./Breadcrumbs.tsx"
/**
* A stand-in for react-router's ``, marked so `Routed` (and its
* test) can show which rungs the injected router was handed.
*/
const SoftRouterLink = ({
href,
...linkProps
}: RouterLinkProps): ReactNode => (
)
/** A document trail ending on the current page. */
const DOCUMENT_TRAIL: BreadcrumbItem[] = [
{ href: "/", label: "Library" },
{ href: "/handbook", label: "Handbook" },
{ href: "/handbook/runbooks", label: "runbooks" },
{ label: "restoring-a-snapshot.md" },
]
/**
* A trail that sits above a heading which already names the page, so
* every rung is a link and none of them is current.
*/
const PLACE_TRAIL: BreadcrumbItem[] = [
{ href: "/places", label: "Places" },
{ href: "/places/office", label: "Office" },
{
href: "/places/office/shelves",
label: "Office Shelves",
},
]
const LONG_TRAIL: BreadcrumbItem[] = [
{ href: "/", label: "Library" },
{ href: "/archive", label: "Archive" },
{ href: "/archive/2026", label: "2026" },
{
href: "/archive/2026/field-recordings",
label: "Field recordings",
},
{
label:
"a-very-long-file-name-with-no-spaces-at-all-0123456789abcdef.flac",
},
]
const meta = {
title: "Components/Layout/Breadcrumbs",
component: Breadcrumbs,
parameters: { layout: "padded" },
// The component's own default, restated so the props table and the
// control agree.
args: {
items: DOCUMENT_TRAIL,
label: "Breadcrumb",
},
} satisfies Meta
export default meta
type Story = StoryObj
export const Playground: Story = {
parameters: playgroundParameters,
}
/**
* The shapes a trail takes. Each cell's landmark carries its own name,
* because four `