2021-06-02 11:50:34 +00:00
|
|
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
|
|
|
|
import { IconButton } from 'components/shared'
|
2021-06-02 21:17:38 +00:00
|
|
|
import Tooltip from 'components/tooltip'
|
2021-06-02 11:50:34 +00:00
|
|
|
import { strokes } from 'lib/shape-styles'
|
|
|
|
import { Square } from 'react-feather'
|
|
|
|
import state, { useSelector } from 'state'
|
|
|
|
import ColorContent from './color-content'
|
|
|
|
|
|
|
|
export default function QuickColorSelect() {
|
|
|
|
const color = useSelector((s) => s.values.selectedStyle.color)
|
|
|
|
|
|
|
|
return (
|
|
|
|
<DropdownMenu.Root>
|
2021-06-02 21:17:38 +00:00
|
|
|
<DropdownMenu.Trigger as={IconButton}>
|
|
|
|
<Tooltip label="Color">
|
|
|
|
<Square fill={strokes[color]} stroke={strokes[color]} />
|
|
|
|
</Tooltip>
|
2021-06-02 11:50:34 +00:00
|
|
|
</DropdownMenu.Trigger>
|
|
|
|
<ColorContent
|
|
|
|
onChange={(color) => state.send('CHANGED_STYLE', { color })}
|
|
|
|
/>
|
|
|
|
</DropdownMenu.Root>
|
|
|
|
)
|
|
|
|
}
|