Skip to content
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

Merged
merged 32 commits into from
Dec 3, 2020

Conversation

ChenCodes
Copy link
Contributor

@ChenCodes ChenCodes commented Dec 1, 2020

Changes in this PR:

  • add color palette component
  • add color control component
  • add unit tests
  • cross browser testing

Demo:
Screen Shot 2020-12-03 at 1 35 42 PM

src/lib/Controls.scss Outdated Show resolved Hide resolved
Copy link
Collaborator

@jstoffan jstoffan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ChenCodes ChenCodes marked this pull request as ready for review December 3, 2020 21:36
@ChenCodes ChenCodes requested a review from a team as a code owner December 3, 2020 21:36
@ChenCodes ChenCodes merged commit 30090ec into box:master Dec 3, 2020
@ChenCodes ChenCodes deleted the add-color-picker-component branch December 3, 2020 23:04
Copy link
Contributor

@ConradJChan ConradJChan left a 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;
Copy link
Contributor

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) {
Copy link
Contributor

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}
Copy link
Contributor

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'];
Copy link
Contributor

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
Copy link
Contributor

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>
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants