import React from 'react' import { IconProps } from '../icons' import { Checkbox, CheckboxProps, useCheckboxStore } from '@ariakit/react' import * as styles from './styles.css' import { Box } from '../Box/Box' import { Text } from '../Text/Text' type Props = Omit & styles.Variants & { iconLeft?: React.ReactElement iconRight?: React.ReactElement } export const SwitchButton: React.FC> = ({ onChange, checked, size, iconLeft, iconRight, children, ...rest }) => { const className = styles.variants({ size, variant: checked ? 'checked' : 'unchecked', }) const checkbox = useCheckboxStore() return ( } className={className} store={checkbox} onChange={onChange} checked={checked} {...rest} > {iconLeft && ( {iconLeft} )} {children && {children}} {iconRight && ( {iconRight} )} ) }