2021-06-02 11:50:34 +00:00
|
|
|
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'
|
2021-06-02 11:50:34 +00:00
|
|
|
import { Square } from 'react-feather'
|
2021-06-28 12:13:34 +00:00
|
|
|
import { breakpoints, IconWrapper, RowButton } from '../shared'
|
|
|
|
import state, { useSelector } from 'state'
|
2021-06-02 11:50:34 +00:00
|
|
|
|
2021-06-28 12:13:34 +00:00
|
|
|
function handleIsFilledChange(isFilled: boolean) {
|
|
|
|
state.send('CHANGED_STYLE', { isFilled })
|
2021-06-02 11:50:34 +00:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:13:34 +00:00
|
|
|
export default function IsFilledPicker(): JSX.Element {
|
|
|
|
const isFilled = useSelector((s) => s.values.selectedStyle.isFilled)
|
|
|
|
|
2021-06-02 11:50:34 +00:00
|
|
|
return (
|
|
|
|
<Checkbox.Root
|
2021-06-27 19:19:57 +00:00
|
|
|
dir="ltr"
|
2021-06-02 11:50:34 +00:00
|
|
|
as={RowButton}
|
2021-06-28 12:13:34 +00:00
|
|
|
bp={breakpoints}
|
2021-06-02 11:50:34 +00:00
|
|
|
checked={isFilled}
|
2021-06-28 12:13:34 +00:00
|
|
|
onCheckedChange={handleIsFilledChange}
|
2021-06-02 11:50:34 +00:00
|
|
|
>
|
|
|
|
<label htmlFor="fill">Fill</label>
|
|
|
|
<IconWrapper>
|
|
|
|
{isFilled || <Square stroke={strokes.Black} />}
|
|
|
|
<Checkbox.Indicator as={CheckIcon} />
|
|
|
|
</IconWrapper>
|
|
|
|
</Checkbox.Root>
|
|
|
|
)
|
|
|
|
}
|