import { Fragment, type ReactNode } from "react"
import type { Meta, StoryObj } from "@storybook/react-vite"
import {
Breadcrumb,
BreadcrumbEllipsis,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@hm-design/ui"
import { StateBoard } from "@/components/story-board"
import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page"
// The representative "Breadcrumb" Story shows each case on one page (real links with sample hrefs); the same specimens also exist
// as Stories tagged `verification` (hidden from the sidebar). BreadcrumbEllipsis is presentational: the Dropdown Menu example is
// a consumer composition, not part of Breadcrumb.
const narrow = (children: ReactNode) =>
{children}
function Basic() {
return (
홈
사용자
상세
)
}
function Ellipsis() {
return (
홈
문서
설정
프로젝트
상세
)
}
function Long() {
const labels = ["홈", "프로젝트", "한맥 프로젝트 관리 시스템", "노선 정보", "시설물 목록", "교량", "상세 정보 및 점검 이력"]
return (
{labels.map((label, i) => (
{i === labels.length - 1 ? {label} : {label}}
{i < labels.length - 1 ? : null}
))}
)
}
// asChild: the link is any element (here a plain standing in for a router Link) and keeps the Breadcrumb look.
function CustomLink() {
return (
홈 (custom link)
/
현재 페이지
)
}
const sections = [
{ id: "basic", label: "Basic", node: },
{ id: "ellipsis", label: "Ellipsis", node: },
{ id: "long", label: "Long path", node: },
{ id: "custom", label: "Custom link · separator", node: },
]
const meta = { title: "Components/Navigation/Breadcrumb", component: Breadcrumb, parameters: { layout: "padded" } } satisfies Meta
export default meta
type Story = StoryObj
const board = (...ids: string[]) => (
ids.includes(s.id)).map((s) => ({ id: s.id, label: s.label, children: narrow(s.node) }))} />
)
// Representative Story: the common Story page; the sections group the same specimens.
export const All: Story = {
name: "Breadcrumb",
parameters: { layout: "fullscreen", controls: { disable: true } },
render: () => (
{board("basic")}
{board("ellipsis", "custom")}
{board("long")}
),
}
export const Basic3: Story = { tags: ["verification"], name: "Basic", render: () => }
export const WithEllipsis: Story = { tags: ["verification"], name: "Ellipsis", render: () => }
export const LongPath: Story = { tags: ["verification"], name: "Long Path", render: () => narrow() }