import React, { useState, type ChangeEventHandler } from 'react' import { type Meta, type StoryObj } from '@storybook/react' import { CheckboxField, type CheckboxFieldProps } from '~components/Checkbox/CheckboxField' import { CheckboxGroup } from '../index' const meta = { title: 'Components/Checkboxes/CheckboxGroup', component: CheckboxGroup, args: { labelText: 'Label', children: ( <> ), }, } satisfies Meta export default meta type Story = StoryObj export const Playground: Story = { render: (args) => { const [checkedStatus, setCheckedStatus] = useState< Record >({ one: 'off', two: 'on', three: 'mixed', }) const onCheckHandler = (id: string): ChangeEventHandler => () => { if (checkedStatus[id] === 'off') { setCheckedStatus({ ...checkedStatus, [id]: 'mixed', }) } else if (checkedStatus[id] === 'mixed') { setCheckedStatus({ ...checkedStatus, [id]: 'on', }) } else if (checkedStatus[id] === 'on') { setCheckedStatus({ ...checkedStatus, [id]: 'off', }) } } return ( ) }, parameters: { docs: { canvas: { sourceState: 'shown', }, }, }, } export const NoBottomMargin: Story = { render: (args) => (
New line of text
New line of text
), }