tldraw/components/style-panel/is-filled-picker.tsx

32 lines
813 B
TypeScript
Raw Normal View History

import * as Checkbox from '@radix-ui/react-checkbox'
import { CheckIcon } from '@radix-ui/react-icons'
2021-06-21 21:35:28 +00:00
import { strokes } from 'state/shape-styles'
import { Square } from 'react-feather'
2021-06-03 12:06:39 +00:00
import { IconWrapper, RowButton } from '../shared'
interface Props {
isFilled: boolean
onChange: (isFilled: boolean | string) => void
}
2021-06-21 21:35:28 +00:00
export default function IsFilledPicker({
isFilled,
onChange,
}: Props): JSX.Element {
return (
<Checkbox.Root
dir="ltr"
as={RowButton}
bp={{ '@initial': 'mobile', '@sm': 'small' }}
checked={isFilled}
onCheckedChange={onChange}
>
<label htmlFor="fill">Fill</label>
<IconWrapper>
{isFilled || <Square stroke={strokes.Black} />}
<Checkbox.Indicator as={CheckIcon} />
</IconWrapper>
</Checkbox.Root>
)
}