import * as React from 'react' import type { Meta, StoryObj } from '@storybook/react-vite' import { ChatPanel } from './ChatPanel' import { ChatInput } from './ChatInput' import { ChatUserMessage } from './ChatUserMessage' import { ChatAssistantMessage } from './ChatAssistantMessage' const meta = { title: 'Components/Chat/ChatPanel', component: ChatPanel, tags: ['autodocs'], parameters: { layout: 'fullscreen' }, } satisfies Meta export default meta type Story = StoryObj export const Default: Story = { args: { title: 'Chat', children: (
), footer: , }, } export const WithHeaderActions: Story = { args: { title: 'Chat Assistant', headerActions: [ { icon: 'settings', label: 'Settings', onClick: () => console.log('Settings') }, { icon: 'more-vertical', label: 'More options', onClick: () => console.log('More') }, { icon: 'x', label: 'Close', onClick: () => console.log('Close') }, ], children: (
), footer: , }, } export const LongScrollingContent: Story = { args: { title: 'Long Conversation', children: (
{Array.from({ length: 20 }, (_, i) => (
))}
), footer: , height: 'TALL', }, } export const NoFooter: Story = { args: { title: 'Read-only Chat', children: (
), }, } export const NoHeader: Story = { args: { children: (
), footer: , }, } export const Interactive: Story = { render: () => { const [messages, setMessages] = React.useState<{ role: 'user' | 'assistant'; text: string }[]>([ { role: 'assistant', text: 'Hi there! How can I help you today?' }, ]) const handleSubmit = (message: string) => { setMessages(prev => [ ...prev, { role: 'user', text: message }, { role: 'assistant', text: 'I received your message. Let me look into that for you.' }, ]) } return ( } >
{messages.map((msg, i) => msg.role === 'user' ? : )}
) }, }