import type { Meta, StoryObj } from '@storybook/react'; import { VirtualizedList } from './virtualized-list'; // Generate 1000 items const items = Array.from({ length: 1000 }, (_, i) => ({ id: i, text: `Item ${i + 1}`, description: `This is the description for item ${i + 1}. Scrolling is optimized.`, })); const meta = { title: 'UI/VirtualizedList', component: VirtualizedList, tags: ['autodocs'], argTypes: { itemHeight: { control: 'number' }, containerHeight: { control: 'number' }, overscan: { control: 'number' }, }, } satisfies Meta>; export default meta; type Story = StoryObj; export const Default: Story = { args: { items, itemHeight: 70, containerHeight: 400, className: 'border border-kodo-steel rounded-md', renderItem: (item) => (
{item.text} {item.description}
), }, }; export const SmallItems: Story = { args: { items, itemHeight: 30, containerHeight: 300, className: 'border border-kodo-steel rounded-md', renderItem: (item) => (
{item.text}
), }, };