-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Allow transparency in color knob #2624
Conversation
Fixes storybookjs#802. Instead of just passing `color.hex`, also pass the alpha value.
<SketchPicker | ||
color={knob.value} | ||
onChange={color => | ||
onChange(` |
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.
This code looks nice, but it generates a huge section of noise in the url:
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.
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.
Can you solve this somehow?
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.
I think this is a formatting issue, since I used a template string and applied prettier to make sure it doesn't exceed the line length (which added newlines). What would you recommend in order to stay within storybook's style guide?
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.
You can ignore the problematic eslint rule for this line.
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.
@Primigenus that's weird, prettier shouldn't insert newlines into text, only into interpolations. And you actually don't have to run it by hand, it runs automatically as precommit hook
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.
There a lot of noise in the url because of the template literal having whitespace
Many thanks for the PR @Primigenus ! If think if you can remove all whitespace we're all good. |
Codecov Report
@@ Coverage Diff @@
## master #2624 +/- ##
==========================================
- Coverage 34.33% 34.33% -0.01%
==========================================
Files 388 388
Lines 8681 8682 +1
Branches 884 906 +22
==========================================
Hits 2981 2981
+ Misses 5100 5083 -17
- Partials 600 618 +18
Continue to review full report at Codecov.
|
Wonderful! Thanks! @Primigenus |
Pass alpha transparency up to the story
Issue: #802
What I did
Instead of just passing
color.hex
, also pass the alpha value.How to test
Add
addon-knobs
and usecolor()
to enable the knob in the story, then try dragging the opacity slider in the color picker or manually setting an alpha value in the field labeled "A".Re: automated testing, not sure. LMK!