material-ui-color icon indicating copy to clipboard operation
material-ui-color copied to clipboard

feat: add a disable prop that disables both textfield and popover

Open jsphbtst opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. Tried to implement ColorPicker with the condition of only allowing the popover to open under specific circumstances. I noticed there wasn't a clear way to prevent users from opening the popover.

Describe the solution you'd like I'd like to push up a PR with changes that include:

  1. adding a disabled prop with type boolean for ColorPicker; and
  2. adding a guard clause to handleClick in ColorPicker to prevent the opening of the popover
  const handleClick = () => {
    if (disabled) return;
    const b = Boolean(refPicker.current);
    setOpen(b);
    if (onOpen) onOpen(b);
  };

This is a minimal and straightforward fix to the aforementioned problem.

jsphbtst avatar Mar 19 '21 10:03 jsphbtst

Already wrote the solution, the tests, and added to storybook locally.

jsphbtst avatar Mar 19 '21 10:03 jsphbtst