homework 1: components

This commit is contained in:
2023-07-29 12:47:02 +02:00
parent e0792c6b6f
commit 06afed2826
35 changed files with 1343 additions and 14 deletions

View File

@@ -0,0 +1,35 @@
import { useState } from 'react'
import { Meta, StoryObj } from '@storybook/react'
import { Checkbox } from './checkbox'
const meta = {
title: 'Components/Checkbox',
component: Checkbox,
tags: ['autodocs'],
} satisfies Meta<typeof Checkbox>
export default meta
type Story = StoryObj<typeof meta>
export const Uncontrolled: Story = {
args: {
label: 'Click here',
disabled: false,
},
}
export const Controlled: Story = {
render: args => {
const [checked, setChecked] = useState(false)
return (
<Checkbox
{...args}
label="Click here"
checked={checked}
onChange={() => setChecked(!checked)}
/>
)
},
}