2021-05-28 20:30:27 +00:00
|
|
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
|
2021-06-21 21:35:28 +00:00
|
|
|
import { strokes } from 'state/shape-styles'
|
2021-06-28 12:13:34 +00:00
|
|
|
import { RowButton, IconWrapper, breakpoints } from '../shared'
|
2021-05-28 20:30:27 +00:00
|
|
|
import { Square } from 'react-feather'
|
2021-06-02 11:50:34 +00:00
|
|
|
import ColorContent from './color-content'
|
2021-06-28 12:13:34 +00:00
|
|
|
import { memo } from 'react'
|
|
|
|
import { useSelector } from 'state'
|
2021-05-26 10:34:10 +00:00
|
|
|
|
2021-06-28 12:13:34 +00:00
|
|
|
function ColorPicker(): JSX.Element {
|
|
|
|
const color = useSelector((s) => s.values.selectedStyle.color)
|
2021-05-26 10:34:10 +00:00
|
|
|
|
|
|
|
return (
|
2021-06-27 19:19:57 +00:00
|
|
|
<DropdownMenu.Root dir="ltr">
|
2021-06-28 12:13:34 +00:00
|
|
|
<DropdownMenu.Trigger as={RowButton} bp={breakpoints}>
|
2021-06-02 11:50:34 +00:00
|
|
|
<label htmlFor="color">Color</label>
|
|
|
|
<IconWrapper>
|
|
|
|
<Square fill={strokes[color]} />
|
|
|
|
</IconWrapper>
|
|
|
|
</DropdownMenu.Trigger>
|
2021-06-28 12:13:34 +00:00
|
|
|
<ColorContent />
|
2021-05-26 10:34:10 +00:00
|
|
|
</DropdownMenu.Root>
|
|
|
|
)
|
|
|
|
}
|
2021-06-28 12:13:34 +00:00
|
|
|
|
|
|
|
export default memo(ColorPicker)
|