style(storybook): refine overlay story layout

This commit is contained in:
shkim4 committed 2026-11-09 16:15:23 +09:00
1 parent bef164489b
commit 3bebe8a660
9 files changed
+214 -93

No files matched your search

+32 -16
View File
@@ -4,6 +4,7 @@ import { Button } from "@hm-design/ui"
import { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@hm-design/ui"
import { Input } from "@hm-design/ui"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@hm-design/ui"
import { StateBoard, type BoardState } from "@/components/story-board"
import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page"
// Dialog is an overlay (Radix Portal), so it does not fit the StateBoard. The representative Story is a row of triggers that open
@@ -161,7 +162,7 @@ function FormContent({ defaultOpen }: { defaultOpen?: boolean }) {
return (
<Frame trigger="폼" defaultOpen={defaultOpen} title="프로젝트 정보" actions={confirmActions}>
<div className="grid gap-2">
<label htmlFor="dialog-form-name" className="text-sm font-medium text-muted-foreground">
<label htmlFor="dialog-form-name" className="text-sm font-medium text-foreground">
프로젝트명
</label>
<Input id="dialog-form-name" size="medium" placeholder="프로젝트명을 입력하세요" />
@@ -176,29 +177,44 @@ type Story = StoryObj<typeof meta>
// Representative Story: the common Story page; every case opens from its trigger. Named after the component, as in ui_viz.
// It is the only Dialog entry in the default sidebar, so Storybook shows Dialog as a single 1-depth item.
// Representative-page layout (Storybook presentation only): equal columns on PC (iframe width 1000px and up), fewer below that
// (200px 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. The trigger keeps its
// own size (the wrapper div stretches, the inline-flex trigger does not). Overlays open in a portal, so this layout never affects them.
function SpecimenGrid({ states, columns = 4 }: { states: BoardState[]; columns?: 4 | 5 }) {
return (
<div className={`grid items-start gap-6 [grid-template-columns:repeat(auto-fill,minmax(min(100%,200px),1fr))] ${columns === 5 ? "min-[1000px]:grid-cols-5" : "min-[1000px]:grid-cols-4"}`}>
{states.map((state) => (
<StateBoard key={state.id} min={10000} states={[{ ...state, children: <div>{state.children}</div> }]} />
))}
</div>
)
}
// Representative Story: the common Story page. Overview is merged into Variants (Basic is its first item).
export const All: Story = {
name: "Dialog",
parameters: { layout: "fullscreen", controls: { disable: true } },
render: () => (
<StoryPage>
<StoryPageHeader
title="Dialog"
/>
<StorySection title="Overview">
<Basic />
</StorySection>
<StoryPageHeader title="Dialog" />
<StorySection title="Variants">
<div className="flex flex-wrap gap-3">
<LongContent />
<WideContent />
<BodyScroll />
</div>
<SpecimenGrid
states={[
{ id: "basic", label: "Basic", children: <Basic /> },
{ id: "long-content", label: "Long Content", children: <LongContent /> },
{ id: "wide-content", label: "Wide Content", children: <WideContent /> },
{ id: "body-scroll", label: "Body Scroll", children: <BodyScroll /> },
]}
/>
</StorySection>
<StorySection title="Usage">
<div className="flex flex-wrap gap-3">
<DeleteConfirmation />
<FormContent />
</div>
<SpecimenGrid
states={[
{ id: "delete-confirmation", label: "Delete Confirmation", children: <DeleteConfirmation /> },
{ id: "form", label: "Form", children: <FormContent /> },
]}
/>
</StorySection>
</StoryPage>
),