veza/apps/web/src/features/chat/components/VirtualizedChatMessages.stories.tsx
2026-02-07 04:44:26 +01:00

62 lines
1.3 KiB
TypeScript

import type { Meta, StoryObj } from '@storybook/react';
import {
VirtualizedChatMessages,
VirtualizedChatMessagesSkeleton,
} from './virtualized-chat-messages';
const meta: Meta<typeof VirtualizedChatMessages> = {
title: 'Components/Features/Chat/VirtualizedChatMessages',
component: VirtualizedChatMessages,
parameters: { layout: 'padded' },
tags: ['autodocs'],
decorators: [
(Story) => (
<div className="bg-background p-4 min-h-layout-page-sm">
<Story />
</div>
),
],
};
export default meta;
type Story = StoryObj<typeof meta>;
const mockMessages = [
{
id: '1',
content: 'Hello world',
sender: { username: 'User1' },
created_at: new Date().toISOString(),
},
{
id: '2',
content: 'Hi there!',
sender: { username: 'User2' },
created_at: new Date().toISOString(),
},
];
export const Default: Story = {
name: 'Par défaut',
args: {
messages: mockMessages,
hasNextPage: false,
isFetching: false,
fetchNextPage: () => {},
},
};
export const Empty: Story = {
name: 'Vide',
args: {
messages: [],
hasNextPage: false,
isFetching: false,
fetchNextPage: () => {},
},
};
export const Loading: Story = {
name: 'Chargement',
render: () => <VirtualizedChatMessagesSkeleton />,
};