tldraw/components/style-panel/quick-color-select.tsx

23 lines
758 B
TypeScript
Raw Normal View History

import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
import { breakpoints, IconButton } from 'components/shared'
2021-06-02 21:17:38 +00:00
import Tooltip from 'components/tooltip'
2021-06-21 21:35:28 +00:00
import { strokes } from 'state/shape-styles'
import { useSelector } from 'state'
import ColorContent from './color-content'
2021-07-01 22:11:09 +00:00
import { BoxIcon } from '../shared'
2021-06-21 21:35:28 +00:00
export default function QuickColorSelect(): JSX.Element {
const color = useSelector((s) => s.values.selectedStyle.color)
return (
<DropdownMenu.Root dir="ltr">
<DropdownMenu.Trigger as={IconButton} bp={breakpoints}>
2021-06-02 21:17:38 +00:00
<Tooltip label="Color">
2021-07-01 22:11:09 +00:00
<BoxIcon fill={strokes[color]} stroke={strokes[color]} />
2021-06-02 21:17:38 +00:00
</Tooltip>
</DropdownMenu.Trigger>
<ColorContent />
</DropdownMenu.Root>
)
}