import type { Meta, StoryObj } from "@storybook/react-vite" import { CheckIcon } from "lucide-react" import { Badge } from "@hm-design/ui" import { StateBoard, type BoardState } from "@/components/story-board" import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page" const variants = ["default", "secondary", "destructive", "outline"] as const const meta = { title: "Components/Data & Display/Badge", component: Badge, parameters: { layout: "padded", docs: { description: { component: "현재 HM 규격: 12/18/500, padding 2/8, radius 4, border 1px. variant는 현재 HM Theme에 의미가 있는 default(primary), secondary(neutral), destructive, outline만 둡니다. success·warning·information은 상태 색이 정해지지 않아 만들지 않았습니다. Button variant를 재사용하지 않는 별도 컴포넌트입니다.", }, }, }, argTypes: { variant: { control: "inline-radio", options: variants } }, } satisfies Meta export default meta type Story = StoryObj // Representative-page layout (Storybook presentation only): equal columns on PC (iframe width 1000px and up), fewer below that // (280px minimum). Each specimen sits in its own single-column StateBoard (min larger than any column), so every subtitle and divider // has the width of its column; a section with fewer specimens than columns leaves the remaining columns empty. const specimenColumns = { 2: "min-[1000px]:grid-cols-2", 3: "min-[1000px]:grid-cols-3", 4: "min-[1000px]:grid-cols-4", } as const function SpecimenGrid({ states, columns }: { states: BoardState[]; columns: 2 | 3 | 4 }) { return (
{states.map((state) => ( ))}
) } // Representative Story: Overview (a plain Badge, already the default item of Variants / Text) is removed. 2 columns on PC. export const All: Story = { name: "Badge", parameters: { layout: "fullscreen", controls: { disable: true } }, render: () => ( {variants.map((v) => ( {v} ))} ), }, { id: "icon", label: "With icon", children: (
{variants.map((v) => ( ))}
), }, ]} />
A very long badge label }, { id: "link", label: "Link", children: ( Link badge ), }, ]} />
), } export const Variants: Story = { tags: ["verification"], render: () => (
{variants.map((v) => ( {v} ))}
), } export const Playground: Story = { tags: ["verification"], args: { variant: "default", children: "Badge" } }