import type { Meta, StoryObj } from 'storybook-solidjs-vite'; import { fn } from 'storybook/test'; import { ConversationItem } from './conversation-item'; import { componentDescription } from '../stories/docs/element-controls'; const baseConversation = { id: '1', title: 'How to use SolidJS signals', messageCount: 8, lastMessageAt: '2026-04-10T12:00:00Z', updatedAt: '2026-04-10T12:00:00Z', scope: { type: 'document' as const }, }; /** * A single selectable row in a conversation/chat list: title plus a message * count, with an active (selected) state. */ const meta = { title: 'Solid (Advanced)/Elements/ConversationItem', component: ConversationItem, tags: ['autodocs'], parameters: { layout: 'padded', docs: { description: componentDescription([ 'A single conversation row — shows the title and message count, truncating long titles, with a highlighted active state.', '**When to use:** as the leaf item inside a chat history sidebar. Usually rendered for you by `ConversationList`; use it directly to build a custom list.', '**How to use:** pass a `conversation` summary, an `isActive` flag, and an `onSelect(id)` handler fired when the row is clicked.', '**Placement:** inside a conversation/chat history sidebar list.', ]), controls: { exclude: ['use:eventListener'] }, }, }, argTypes: { conversation: { control: 'object', description: 'The conversation summary (id, title, messageCount, scope, timestamps).', }, isActive: { control: 'boolean', description: 'Whether this row is the currently selected conversation.', }, onSelect: { action: 'select', description: 'Fired with the conversation id when the row is clicked.', table: { category: 'Events' }, }, }, args: { conversation: baseConversation, isActive: false, onSelect: fn(), }, render: (args) => (