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: add a disable prop that disables both textfield and popover #130

Open
jsphbtst opened this issue Mar 19, 2021 · 1 comment
Open

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

jsphbtst opened this issue Mar 19, 2021 · 1 comment

Comments

@jsphbtst
Copy link

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

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

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

No branches or pull requests

1 participant