import type { Meta, StoryObj } from "@storybook/react" import { Sortable, SortableItem, SortableItemTrigger, SortableList, SortableOverlay, useSortableList, } from "." const meta: Meta = { title: "SortableList/SortableList", component: SortableList, parameters: { docs: { description: { component: "A sortable list component using dnd-kit, supporting drag-and-drop reordering.", }, }, }, } export default meta type Args = { initialItems: string[] } type Story = StoryObj const BasicStory = (args: Args) => { const { items, activeId, handleDragStart, handleDragEnd, handleDragCancel } = useSortableList({ items: args.initialItems, }) return ( {items.map(id => ( {id} ))} {activeId ? (
{activeId}
) : null}
) } export const Basic: Story = { render: BasicStory, args: { initialItems: ["Item 1", "Item 2", "Item 3", "Item 4"], }, argTypes: { initialItems: { control: { type: "object" }, description: "Initial list of items to sort.", }, }, }