import { type Meta, type StoryFn } from '@storybook/react' import { Text } from '~/src/components/Text' import { SegmentedControl, SegmentedControlItem, SegmentedControlTabContent, SegmentedControlTabList, } from './SegmentedControl' import { type SegmentedControlProps } from './SegmentedControl.types' const meta: Meta = { component: SegmentedControl, argTypes: { type: { control: { type: 'radio', }, options: ['radiogroup', 'tabs'], }, value: { control: { type: 'text', }, }, defaultValue: { control: { type: 'text', }, }, }, } export default meta const VALUES = [ { value: '1', label: 'First', }, { value: '2', label: 'Second', }, { value: '3', label: 'Third', }, ] const Template: StoryFn> = ({ type, ...rest }) => (
{type === 'radiogroup' ? ( VALUES.map(({ value, label }) => ( {label} )) ) : ( <> {VALUES.map(({ value, label }) => ( {label} ))} {VALUES.map(({ value, label }) => ( {label} ))} )}
) export const Primary = { render: Template, args: { type: 'radiogroup', size: 'xs', width: '100%', value: undefined, defaultValue: undefined, disabled: false, }, }