import React, { useState } from 'react'; import { Meta, Story } from '@storybook/react'; import RadioButtonLabeled, { IRadioButtonLabeledProps, } from './RadioButtonLabeled'; export default { title: 'Controls/RadioButtonLabeled', component: RadioButtonLabeled, parameters: { docs: { description: { component: RadioButtonLabeled.peek.description, }, }, }, args: RadioButtonLabeled.defaultProps, } as Meta; /* Basic */ export const Basic: Story = (args) => { const style = { marginBottom: '3px', }; const [flavor, setFlavor] = useState('vanilla'); const handleSelectedFlavor = (flavor: string) => { setFlavor(flavor); }; return (
handleSelectedFlavor('vanilla')} style={style} > Vanilla handleSelectedFlavor('chocolate')} style={style} > Chocolate handleSelectedFlavor('strawberry')} style={style} > Strawberry handleSelectedFlavor('saltedCaramel')} style={style} > Salted caramel handleSelectedFlavor('mintChip')} style={style} > Mint chocolate chip (the best)
); }; /* States */ export const States: Story = (args) => { const style = { marginBottom: '3px', marginRight: '13px', }; return (
(default props)
Disabled Selected Disabled and Selected
); }; /* Label As Child */ export const LabelAsChild: Story = (args) => { const style = { marginBottom: '3px', }; return (
Just text HTML element
); }; /* Label As Prop */ export const LabelAsProp: Story = (args) => { const style = { marginBottom: '3px', }; return (
HTML element} style={style} > HTML element in an array, Again only the first value in the array is used , The rest should not be rendered, ] as any } style={style} >
); };