import type { ReactNode } from "react"
import type { Meta, StoryObj } from "@storybook/react-vite"
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@hm-design/ui"
import { StateBoard } from "@/components/story-board"
import { STORY_KICKER, StoryPage, StoryPageHeader, StorySection } from "@/components/story-page"
// The representative Story shows real, draggable layouts; the same specimens also exist as Stories tagged `verification` (hidden
// from the sidebar). react-resizable-panels v4 sizes: a string without a unit ("30") or with "%" is a percentage, a number is
// pixels. The frames (size, border) and panel content are Story layout. These are not Dashboard layouts.
const frame = (node: ReactNode, height = 200) => (
{node}
)
const Pane = ({ children }: { children: ReactNode }) => {children}
function Horizontal() {
return frame(
목록 (min 15%)
상세
)
}
function Vertical() {
return frame(
위
아래
,
240
)
}
function WithHandle() {
return frame(
A
B
)
}
function MinMax() {
return frame(
25% – 60%
나머지
)
}
function Collapsible() {
return frame(
사이드 (끌면 접힘)
본문
)
}
const sections = [
{ id: "horizontal", label: "Horizontal (list min 15%)", node: },
{ id: "vertical", label: "Vertical with grip", node: },
{ id: "handle", label: "Horizontal with grip", node: },
{ id: "minmax", label: "Min / max (25%–60%)", node: },
{ id: "collapsible", label: "Collapsible panel", node: },
]
const meta = { title: "Components/Disclosure/Resizable", component: ResizablePanelGroup, 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: "Resizable",
parameters: { layout: "fullscreen", controls: { disable: true } },
render: () => (
{board("horizontal")}
{board("vertical", "handle")}
{board("minmax", "collapsible")}
),
}
export const HorizontalLayout: Story = { tags: ["verification"], name: "Horizontal", render: () => }
export const VerticalLayout: Story = { tags: ["verification"], name: "Vertical", render: () => }
export const MinMaxLayout: Story = { tags: ["verification"], name: "Min Max", render: () => }