import { createBoard } from '@wixc3/react-board'; import { Label, Switch, type SwitchProps } from '@blueprintjs/core'; import { useState } from 'react'; // board cover import cover from '../../../../assets/form-controls/switch.svg'; export default createBoard({ name: 'Switch', Board: () => { const [checkboxes, setCheckboxes] = useState([ { name: 'Enabled', checked: false }, { name: 'Public', checked: false }, { name: 'Cooperative', checked: true }, ]); const handleChange = (option: SwitchProps) => { setCheckboxes((prev) => prev.map((checkbox) => checkbox.name === option.name ? { ...option, checked: !option.checked } : checkbox ) ); }; return ( <> {checkboxes.map((option) => ( handleChange(option)} /> ))} ); }, tags: ['switch', 'form', 'controls'], cover, });