import { type Meta, type StoryObj } from '@storybook/react-vite' import React, { useState } from 'react' import { DocsTemplate } from '../../../.storybook' import Switch from './Switch' export default { title: 'Components/Switch/With Label', component: Switch, parameters: { design: { type: 'figma', url: 'https://www.figma.com/design/RvhKD82948FMQnh5MyCi0o/Web-Design-System?node-id=121-347&p=f&t=v3aRLCcxAtwvrbEe-0', }, docs: { page: () => ( The Switch component is a user interface element that allows users to switch between two states, typically representing an "on" and "off" state. It returns a boolean value, either{' '} true or false, indicating the current state of the switch. It is commonly used in forms and settings panels to enable users to turn specific features or options on or off. } infoBullets={[ Include the Switch component within forms or settings sections where users need to make binary choices or enable/disable specific functionalities. , ]} /> ), }, }, } as Meta type Story = StoryObj const Template: Story = { render: function Render(args) { const [checked, setChecked] = useState(args.checked) const callout = (val: boolean) => { setChecked(val) } return ( ) }, } export const Basic: Story = { ...Template, args: { checked: true, formLabelProps: { label: 'This is a label' }, }, } export const Required: Story = { ...Template, args: { checked: true, formLabelProps: { label: 'This is a label', required: true }, }, } export const Disabled: Story = { ...Template, args: { checked: true, formLabelProps: { label: 'This is a label' }, disabled: true, }, } export const Tooltip: Story = { ...Template, args: { checked: true, formLabelProps: { label: 'This is a label', tooltip: { tooltipContent: 'This is a tooltip' }, }, }, }