-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(drawing): add color picker component #1300
Conversation
src/lib/viewers/controls/color-picker/__tests__/ColorPickerControl-test.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, was late to the game. Just a few comments for future revisions
export type Props = { | ||
annotationMode?: AnnotationMode; | ||
onAnnotationColorClick: (color: string) => void; | ||
isActive?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: 🔤
}: Props): JSX.Element | null { | ||
const [isColorPickerToggled, setIsColorPickerToggled] = useState(false); | ||
|
||
if (annotationMode !== AnnotationMode.DRAWING) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this picker need to know about annotations at all? Could the rendering of this ColorPickerControl
be controlled by the consuming component?
})} | ||
onClick={(): void => setIsColorPickerToggled(!isColorPickerToggled)} | ||
type="button" | ||
{...rest} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a bit odd to spread the rest
props onto a nested elements instead of the root element. Is this needed for something?
}; | ||
|
||
export default function ColorPickerPalette({ onColorSelect }: Props): JSX.Element { | ||
const colors = ['#0061d5', '#26c281', '#ed3757', '#f5b31b', '#ffd700', '#4826c2']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these colors be moved outside of the function?
/> | ||
</div> | ||
)} | ||
<button |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need a resin tag and/or testid attributes? Similarly for the ColorPickerPalette
onAnnotationModeEscape={onAnnotationModeEscape} | ||
/> | ||
</ControlsBar> | ||
<ControlsBar> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be added to the ImageControls
as well?
Changes in this PR:
Demo: