import type { Meta, StoryObj } from "@storybook/react-vite"
import { Card, CardContent, CardHeader, Skeleton } from "@hm-design/ui"
import { StateBoard } from "@/components/story-board"
import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page"
// Skeleton is a visual placeholder; size and shape come from `className` (layout classes here are Story composition).
// There is no data fetching. The representative Story shows text lines, an avatar, and a card / list loading composition.
function TextLines() {
return (
)
}
function AvatarRow() {
return (
)
}
function CardLoading() {
return (
)
}
const sections = [
{ id: "text", label: "Text", node: },
{ id: "avatar", label: "Avatar + text", node: },
{ id: "card", label: "Card / list loading", node: },
]
const meta = { title: "Components/Data & Display/Skeleton", component: Skeleton, parameters: { layout: "padded" } } 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
// (240px 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({ ids, columns, spans = {} }: { ids: string[]; columns: 2 | 3 | 4; spans?: Record }) {
return (
{ids.map((id) => {
const s = sections.find((section) => section.id === id)!
return (
)
})}
)
}
// Representative Story: the common Story page; the sections group the same specimens.
// Representative Story: Overview / Usage are merged into one Variants section (Text, Avatar + text, Card / list loading). 3 columns on PC.
export const All: Story = {
name: "Skeleton",
parameters: { layout: "fullscreen", controls: { disable: true } },
render: () => (
),
}
export const Text: Story = { tags: ["verification"], render: () => }
export const CardList: Story = { tags: ["verification"], name: "Card List", render: () => }