import type { Meta, StoryObj } from '@storybook/react'; import DataTable from './datatable'; const meta = { title: 'Organisms/DataTable', component: DataTable, parameters: { layout: 'centered', }, tags: ['autodocs'], } satisfies Meta; export default meta; type Story = StoryObj; export const Default: Story = { args: { data: [ { id: 1, name: 'John Doe', email: 'john@example.com', phone: '123-456-7890', address: '123 Main St', }, { id: 2, name: 'Jane Smith', email: 'jane@example.com', phone: '987-654-3210', address: '456 Elm St', }, { id: 3, name: 'John Smith', email: 'johns@example.com', phone: '456-789-1230', address: '789 Cedar St', }, ], headers: [ { label: 'ID', key: 'id' }, { label: 'Name', key: 'name' }, { label: 'Email', key: 'email' }, { label: 'Phone', key: 'phone' }, { label: 'Address', key: 'address' }, ], onRowClick: (item) => console.log('Row clicked:', item), }, }; export const WithCustomRender: Story = { args: { data: [ { id: 1, name: 'John Doe', email: 'john@example.com', phone: '123-456-7890', address: '123 Main St', status: 'active', }, { id: 2, name: 'Jane Smith', email: 'jane@example.com', phone: '987-654-3210', address: '456 Elm St', status: 'inactive', }, { id: 3, name: 'John Smith', email: 'johns@example.com', phone: '456-789-1230', address: '789 Cedar St', status: 'active', }, ], headers: [ { label: 'ID', key: 'id' }, { label: 'Name', key: 'name' }, { label: 'Email', key: 'email' }, { label: 'Phone', key: 'phone' }, { label: 'Status', render: (item) => ( {item.status} ), }, { label: 'Actions', render: (item) => ( ), }, ], onRowClick: (item) => console.log('Row clicked:', item), }, }; export const WithoutCheckbox: Story = { args: { ...Default.args, showCheckbox: false, }, };