import type { Meta, StoryObj } from "@storybook/react-vite" import { Avatar, AvatarFallback, AvatarImage } from "@hm-design/ui" import { StateBoard } from "@/components/story-board" import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page" // Images are inline data URIs so the Story does not depend on the network. "Broken" uses an address that cannot load so the // Radix fallback shows. Radix renders the image only after it loads. const photo = "data:image/svg+xml;utf8," + encodeURIComponent( '' ) function Sizes() { return (
{(["sm", "default", "lg"] as const).map((size) => (
한맥 {size}
))}
) } // `showCaption={false}` drops the captions on the representative page (they restate the visible fallback text); the verification Story keeps them. function Fallbacks({ showCaption = true }: { showCaption?: boolean }) { const items = [ { label: "한글 두 글자", text: "김한" }, { label: "영문 두 글자", text: "HM" }, { label: "한 글자", text: "한" }, { label: "긴 fallback", text: "ABCDEFGHIJ" }, ] return (
{items.map((i) => (
{i.text} {showCaption ? {i.label} : null}
))}
) } function Group() { return (
김한
김한맥 노선 설계팀
) } const sections = [ { id: "image", label: "Image", node: }, { id: "fallback", label: "Fallback", node: }, { id: "composition", label: "Composition", node: }, ] const meta = { title: "Components/Data & Display/Avatar", component: Avatar, 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: "Avatar", parameters: { layout: "fullscreen", controls: { disable: true } }, render: () => ( {board("image")} {board("fallback")} {board("composition")} ), } export const Image: Story = { tags: ["verification"], render: () => } export const FallbackError: Story = { tags: ["verification"], name: "Fallback", render: () => }