Files
HMDesign/src/components/alert.stories.tsx
T
shkim4 da0e647b49 docs(storybook): simplify sidebar Story pages around the UI
Drop the category kicker from the 83 sidebar Stories (kicker is now optional;
hidden verification Stories keep it) and shorten or remove repeated, obvious
or internal page/section descriptions. Required specs, limits, virtual-data
and undecided-value notices stay. Story IDs, exports, fixtures, shared state
notes and package code are unchanged. Record: docs/reports/storybook-ui-simplification-2026-10-22.md
2026-10-22 16:13:58 +09:00

133 lines
4.3 KiB
TypeScript

import type { Meta, StoryObj } from "@storybook/react-vite"
import { InfoIcon, TriangleAlertIcon } from "lucide-react"
import { Alert, AlertDescription, AlertTitle } from "@hm-design/ui"
import { StateBoard } from "@/components/story-board"
import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page"
const meta = {
title: "Components/Feedback/Alert",
component: Alert,
parameters: {
layout: "padded",
docs: {
description: {
component:
"현재 HM 규격: 인라인 메시지(Toast 아님). padding 12/16, radius 4, border 1px, Title 14/20/500, Description 14/20/400. variant는 default(neutral)와 destructive만 둡니다. success·warning·information은 HM 상태 색이 정해지지 않아 만들지 않았습니다. 닫기 동작은 없습니다.",
},
},
},
argTypes: { variant: { control: "inline-radio", options: ["default", "destructive"] } },
} satisfies Meta<typeof Alert>
export default meta
type Story = StoryObj<typeof meta>
export const All: Story = {
name: "Alert",
parameters: { layout: "fullscreen", controls: { disable: true } },
render: () => (
<StoryPage>
<StoryPageHeader
title="Alert"
description="인라인 메시지(Toast 아님) · default / destructive만 · 닫기 없음"
/>
<StorySection title="Overview">
<StateBoard
min={320}
states={[
{
id: "default",
label: "Default",
children: (
<Alert>
<InfoIcon aria-hidden="true" />
<AlertTitle>Heads up</AlertTitle>
<AlertDescription>You can update your project settings at any time.</AlertDescription>
</Alert>
),
},
]}
/>
</StorySection>
<StorySection title="Variants">
<StateBoard
min={320}
states={[
{
id: "destructive",
label: "Destructive",
children: (
<Alert variant="destructive">
<TriangleAlertIcon aria-hidden="true" />
<AlertTitle>Unable to save</AlertTitle>
<AlertDescription>Check the project name and try again.</AlertDescription>
</Alert>
),
},
]}
/>
</StorySection>
<StorySection title="Usage">
<StateBoard
min={320}
states={[
{
id: "no-icon",
label: "No icon",
children: (
<Alert>
<AlertTitle>Title only layout</AlertTitle>
<AlertDescription>Without an icon the text starts at the left edge.</AlertDescription>
</Alert>
),
},
{
id: "title-only",
label: "Title only",
children: (
<Alert>
<InfoIcon aria-hidden="true" />
<AlertTitle>Saved</AlertTitle>
</Alert>
),
},
{
id: "long",
label: "Long content",
children: (
<div className="max-w-xs">
<Alert>
<InfoIcon aria-hidden="true" />
<AlertTitle>Scheduled maintenance</AlertTitle>
<AlertDescription>The service will be unavailable for a short time during the maintenance window. Please save your work before it starts.</AlertDescription>
</Alert>
</div>
),
},
]}
/>
</StorySection>
</StoryPage>
),
}
export const Default: Story = {
tags: ["verification"],
render: () => (
<Alert>
<InfoIcon aria-hidden="true" />
<AlertTitle>Heads up</AlertTitle>
<AlertDescription>You can update your project settings at any time.</AlertDescription>
</Alert>
),
}
export const Destructive: Story = {
tags: ["verification"],
render: () => (
<Alert variant="destructive">
<TriangleAlertIcon aria-hidden="true" />
<AlertTitle>Unable to save</AlertTitle>
<AlertDescription>Check the project name and try again.</AlertDescription>
</Alert>
),
}