import type { Meta, StoryObj } from "@storybook/react-vite" import { AspectRatio, Card, CardContent } from "@hm-design/ui" import { StateBoard } from "@/components/story-board" import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page" // AspectRatio is a layout primitive: it keeps the ratio and nothing else. The image styling (object-fit, radius) in these Stories is // the consumer's composition on the child, not part of AspectRatio. Images are inline data URIs (no network). The Card example only // shows how a consumer can compose it; AspectRatio does not depend on Card. const svg = (label: string, fill: string) => "data:image/svg+xml;utf8," + encodeURIComponent( `${label}` ) function Image({ ratio, label }: { ratio: number; label: string }) { return (
{`${label}
) } function Placeholder() { return (
영상 영역 16:9
) } function InCard() { return ( 카드 안 4:3 이미지 ) } const sections = [ { id: "r169", label: "16:9", node: }, { id: "r43", label: "4:3", node: }, { id: "r11", label: "1:1", node: }, { id: "video", label: "Video", node: }, { id: "card", label: "Card", node: }, ] const meta = { title: "Components/Data & Display/Aspect Ratio", component: AspectRatio, 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: s.node }))} /> ) // Representative Story: the common Story page; the sections group the same specimens. export const All: Story = { name: "Aspect Ratio", parameters: { layout: "fullscreen", controls: { disable: true } }, render: () => ( {board("r169")} {board("r43", "r11", "video")} {board("card")} ), } export const Wide: Story = { tags: ["verification"], name: "16:9", render: () => } export const Square: Story = { tags: ["verification"], name: "1:1", render: () => }