import type { ReactNode } from "react" import type { Meta, StoryObj } from "@storybook/react-vite" import { NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, } from "@hm-design/ui" import { StateBoard } from "@/components/story-board" import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page" // Navigation Menu is for destinations (links), not commands. The representative Story opens the real menus with hover, click or // keyboard; the same specimens also exist as Stories tagged `verification` (hidden from the sidebar). Title + description children // inside a content link are marked with `data-description` for the secondary text. function Destination({ href, title, description, active }: { href: string; title: string; description?: string; active?: boolean }) { return ( {title} {description ? {description} : null} ) } function Specimen({ viewport = true }: { viewport?: boolean }) { return ( 제품
자료
회사 문의 준비 중
{viewport ? : null}
) } // Size specimens to their review area (including the panel's 8px padding + 1px border on each side). // Mobile uses the content's natural minimum width instead of a fixed desktop specimen width. // `minHeight: 256` reserves room for the open panel (about 232px below the menu bar) so it never covers what follows. // `compact` (representative page only) drops that reservation on PC (iframe width 1000px and up), where the two examples sit side by // side and nothing is below them; in the one-column layout below 1000px the 256px stays so an open menu does not cover the next example. const frame = (node: ReactNode, compact = false) => (
{node}
) const meta = { title: "Components/Navigation/Navigation Menu", component: NavigationMenu, parameters: { layout: "padded" } } satisfies Meta export default meta type Story = StoryObj export const All: Story = { name: "Navigation Menu", parameters: { layout: "fullscreen", controls: { disable: true } }, render: () => ( {/* Overview is merged into Variants (Viewport is its first item). Two equal columns on PC (iframe width 1000px and up), one column below that; each specimen sits in its own single-column StateBoard (min larger than any column). */}
, true) }]} /> , true) }]} />
), } export const Default: Story = { tags: ["verification"], render: () => frame() } export const NoViewport: Story = { tags: ["verification"], name: "No Viewport", render: () => frame() } // Three enabled triggers with different widths exercise first / middle / last offsets in both positioning modes. export const IndicatorAlignment: Story = { tags: ["verification"], render: () => ( ({ id: viewport ? "viewport" : "no-viewport", label: `Indicator alignment · viewport=${viewport}`, children: frame( {["제품", "기술 자료", "지원 센터"].map((label) => ( {label} ))} {viewport ? : null} ), }))} /> ), }