2021-06-02 11:50:34 +00:00
|
|
|
import { IconButton } from 'components/shared'
|
2021-06-21 21:35:28 +00:00
|
|
|
import { strokes } from 'state/shape-styles'
|
2021-06-02 11:50:34 +00:00
|
|
|
import { ColorStyle } from 'types'
|
|
|
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
|
|
|
|
import { Square } from 'react-feather'
|
2021-06-03 12:06:39 +00:00
|
|
|
import { DropdownContent } from '../shared'
|
2021-06-02 11:50:34 +00:00
|
|
|
|
|
|
|
export default function ColorContent({
|
|
|
|
onChange,
|
|
|
|
}: {
|
|
|
|
onChange: (color: ColorStyle) => void
|
2021-06-21 21:35:28 +00:00
|
|
|
}): JSX.Element {
|
2021-06-02 11:50:34 +00:00
|
|
|
return (
|
2021-06-03 16:13:23 +00:00
|
|
|
<DropdownContent sideOffset={8} side="bottom">
|
2021-06-02 11:50:34 +00:00
|
|
|
{Object.keys(strokes).map((color: ColorStyle) => (
|
|
|
|
<DropdownMenu.DropdownMenuItem
|
|
|
|
as={IconButton}
|
|
|
|
key={color}
|
|
|
|
title={color}
|
|
|
|
onSelect={() => onChange(color)}
|
|
|
|
>
|
|
|
|
<Square fill={strokes[color]} stroke="none" size="22" />
|
|
|
|
</DropdownMenu.DropdownMenuItem>
|
|
|
|
))}
|
|
|
|
</DropdownContent>
|
|
|
|
)
|
|
|
|
}
|