import type { Meta, StoryObj } from "@storybook/react-vite"
import { BoldIcon, ItalicIcon, StarIcon } from "lucide-react"
import { Toggle, ToggleGroup, ToggleGroupItem } from "@hm-design/ui"
import { StateBoard, type BoardState } from "@/components/story-board"
import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page"
// Toggle is a persistent pressed-state control. The representative Story shows each state with real, clickable toggles; the same
// specimens also exist as Stories tagged `verification` (hidden from the sidebar). Icon-only toggles carry an `aria-label`.
function OffOn() {
return (
Off
On
Outline off
Outline on
)
}
function WithIcon() {
return (
즐겨찾기
)
}
function Sizes() {
return (
// 3 equal columns on PC (iframe width 1000px and up): sm / default / lg; fewer columns below that (240px minimum).
{(["sm", "default", "lg"] as const).map((size) => (
즐겨찾기
{size}
))}
)
}
function Disabled() {
return (
Disabled off
Disabled on
)
}
const sections = [
{ id: "offon", label: "Off / On", node: },
{ id: "disabled", label: "Disabled", node: },
]
const meta = { title: "Components/Form/Toggle", component: Toggle, parameters: { layout: "padded" } } satisfies Meta
export default meta
type Story = StoryObj
// Representative-page layout (Storybook presentation only). StateBoard's own auto-fill grid cannot give equal columns that
// fill a cell, so each specimen sits in its own single-column StateBoard (min larger than any column) inside a grid.
const specimen = (id: string): BoardState => {
const s = sections.find((section) => section.id === id)!
return { id: s.id, label: s.label, children: s.node }
}
function SpecimenGrid({ states }: { states: BoardState[] }) {
return (
{states.map((state) => (
))}
)
}
// Representative Story: the common Story page; the sections group the same specimens.
// Overview is renamed Variants. On PC (iframe width 1000px and up) Variants and States use the first two of the same 3 equal
// columns as the rows below, and the third column stays empty; below that they stack.
export const All: Story = {
name: "Toggle",
parameters: { layout: "fullscreen", controls: { disable: true } },
render: () => (
알림 },
{ id: "group-single", label: "연결 그룹 · 단일 선택", children: 왼쪽가운데오른쪽 },
{ id: "group-multiple", label: "연결 그룹 · 다중 선택", children: 굵게기울임 },
]}
/>
),
}
export const States: Story = { tags: ["verification"], render: () => }
export const IconOnly: Story = { tags: ["verification"], name: "Icon Only", render: () => }
export const DisabledToggle: Story = { tags: ["verification"], name: "Disabled", render: () => }
export const ContentNodes: Story = {
tags: ["verification"],
render: () => (
{[]}
<>>
<>즐겨찾기>
즐겨찾기
),
}