import { DemoStory } from '../demo/demo-types'; import { ResizableSplitter } from './resizable-splitter'; export const resizableSplitterDemo: DemoStory = { id: 'resizable-splitter-demo', text: 'Resizable Splitter Demo', args: { isVertical: true, }, argTypes: { isVertical: { control: 'boolean', description: 'If true, splits left/right. If false, splits top/bottom' }, }, render: (args) => { // The splitter hook targets a selector, so we create a unique container. const containerId = 'splitter-demo-box'; // The logic expects to re-mount the splitter or reload the page for structural updates normally, // but we can hack it together for the demo by destroying and recreating the DOM. // For simplicity, we just use a fixed layout that reacts to the boolean toggle. if (args.isVertical) { return (
Left Panel (Drag right edge)
{ResizableSplitter.getSplitter(`#${containerId}`, true, true)}
Right Panel (Flex 1)
); } else { return (
Top Panel (Drag bottom edge)
{ResizableSplitter.getSplitter(`#${containerId}`, false, false)}
Bottom Panel (Flex 1)
); } }, code: `import { ResizableSplitter } from 'lupine.components/components/resizable-splitter'; {/* Left/Right Splitter (isVertical=true means the divider line is vertical) */}
Left Panel (Drag right edge)
{ResizableSplitter.getSplitter('#splitter-demo-box', true, true)}
`, };