import type { Meta, StoryObj } from '@storybook/nextjs-vite'; import { Smile, Monitor, Globe, Zap } from 'lucide-react'; import { useState } from 'react'; import { SelectButton } from '../components/features/select-button'; const meta = { title: 'Features/SelectButton', component: SelectButton, parameters: { layout: 'centered', }, tags: ['autodocs'], argTypes: { title: { control: 'text' }, description: { control: 'text' }, selected: { control: 'boolean' }, disabled: { control: 'boolean' }, }, } satisfies Meta; export default meta; type Story = StoryObj; export const Default: Story = { args: { title: 'Option', description: 'Description text', selected: false, }, }; export const Selected: Story = { args: { title: 'Option', description: 'Description text', selected: true, }, }; export const WithIcon: Story = { args: { title: 'Option', description: 'Description text', icon: , }, }; export const WithIconSelected: Story = { args: { title: 'Option', description: 'Description text', icon: , selected: true, }, }; export const WithImage: Story = { args: { title: 'Option', description: 'Description text', image: { src: 'https://placehold.co/40x40/212121/fafafa?text=Img', alt: 'Sample', }, }, }; export const WithImageSelected: Story = { args: { title: 'Option', description: 'Description text', image: { src: 'https://placehold.co/40x40/212121/fafafa?text=Img', alt: 'Sample', }, selected: true, }, }; export const NoDescription: Story = { args: { title: 'Title Only', }, }; export const Disabled: Story = { args: { title: 'Disabled', description: 'Cannot select', disabled: true, }, }; export const IconWithTitleOnly: Story = { args: { title: 'Option', icon: , }, }; export const WithTag: Story = { args: { title: 'MacOS', icon: , tag: 'Coming Soon', }, }; export const WithTagDisabled: Story = { args: { title: 'MacOS', icon: , tag: 'Coming Soon', disabled: true, }, }; export const WithTagSelected: Story = { args: { title: 'MacOS', icon: , tag: 'Coming Soon', selected: true, }, }; export const InteractiveGroup = { render: () => { const [selectedId, setSelectedId] = useState('monitor'); const options = [ { id: 'monitor', title: 'Monitor', description: 'System monitoring', icon: }, { id: 'web', title: 'Web App', description: 'Browser based', icon: }, { id: 'api', title: 'API', description: 'REST endpoints', icon: }, ]; return (
{options.map(option => ( setSelectedId(option.id)} /> ))}
); }, }; export const InteractiveIconTitleOnly = { render: () => { const [selectedId, setSelectedId] = useState('monitor'); const options = [ { id: 'monitor', title: 'Monitor', icon: }, { id: 'web', title: 'Web App', icon: }, { id: 'api', title: 'API', icon: }, ]; return (
{options.map(option => ( setSelectedId(option.id)} /> ))}
); }, };