tldraw/components/style-panel/color-picker.tsx
2021-06-03 13:06:39 +01:00

25 lines
737 B
TypeScript

import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
import { strokes } from 'lib/shape-styles'
import { ColorStyle } from 'types'
import { RowButton, IconWrapper } from '../shared'
import { Square } from 'react-feather'
import ColorContent from './color-content'
interface Props {
color: ColorStyle
onChange: (color: ColorStyle) => void
}
export default function ColorPicker({ color, onChange }: Props) {
return (
<DropdownMenu.Root>
<DropdownMenu.Trigger as={RowButton}>
<label htmlFor="color">Color</label>
<IconWrapper>
<Square fill={strokes[color]} />
</IconWrapper>
</DropdownMenu.Trigger>
<ColorContent onChange={onChange} />
</DropdownMenu.Root>
)
}