veza/apps/web/src/components/ui/VirtualizedList.stories.tsx
senke 2c9c39a8a1 feat(storybook): complete UI component coverage (batches 6-9)
- Batch 6: FAB, FormField, FloatingInput, AvatarUpload
- Batch 7: Modal, ConfirmationDialog, ImageViewerModal, ErrorDisplay, LoadingState
- Batch 8: DataList, WaveformVisualizer, OptimizedImage, VirtualizedList
- Batch 9: ImageCropper, LoadingSpinner, FocusTrap
- Achieved total coverage for src/components/ui
2026-02-02 19:50:45 +01:00

58 lines
1.7 KiB
TypeScript

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<typeof VirtualizedList<typeof items[0]>>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
items,
itemHeight: 70,
containerHeight: 400,
className: 'border border-kodo-steel rounded-md',
renderItem: (item) => (
<div
key={item.id}
className="h-[70px] p-4 border-b border-kodo-steel flex flex-col justify-center hover:bg-white/5 transition-colors"
>
<span className="font-bold text-white">{item.text}</span>
<span className="text-xs text-kodo-content-dim">{item.description}</span>
</div>
),
},
};
export const SmallItems: Story = {
args: {
items,
itemHeight: 30,
containerHeight: 300,
className: 'border border-kodo-steel rounded-md',
renderItem: (item) => (
<div
key={item.id}
className="h-[30px] px-4 flex items-center border-b border-white/5 hover:bg-white/5 text-sm"
>
{item.text}
</div>
),
},
};