-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Icon: Remove knobs in stories #46517
Conversation
Size Change: 0 B Total Size: 1.32 MB ℹ️ View Unchanged
|
); | ||
|
||
export const _default = () => { | ||
const size = number( 'Size', '24' ); |
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 removed this explicit 24px default, since we should just showcase the default component behavior here (which is 20 when icon
is a Dashicon, and 24 when otherwise).
export const sizes = () => { | ||
const iconSizes = [ 14, 16, 20, 24, 28, 32, 40, 48, 56 ]; |
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 removed this story because it kind of implies that this set of numbers is our official sizing scale. Plus, the size
prop is very easy to discover, so no need to highlight this specifically.
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 is good to know - I actually thought those are the recommended / official sizes. Good to know they aren't 👍
}; | ||
|
||
export const colors = () => { | ||
const iconColors = [ 'blue', 'purple', 'green' ]; |
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.
Also simplified this to only show one color, as this fits the Controls paradigm better.
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.
Theoretically, we could introduce a control for the color, but I'm not sure if that's worth the effort.
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.
We can't really add a control for things that are not component props, since we want to maintain a 1:1 relationship between props and controls.
I've been wanting to add an official prop to set fill colors though! #40102
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.
Looking and working great 👍 🚀
export const sizes = () => { | ||
const iconSizes = [ 14, 16, 20, 24, 28, 32, 40, 48, 56 ]; |
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 is good to know - I actually thought those are the recommended / official sizes. Good to know they aren't 👍
}; | ||
|
||
export const colors = () => { | ||
const iconColors = [ 'blue', 'purple', 'green' ]; |
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.
Theoretically, we could introduce a control for the color, but I'm not sure if that's worth the effort.
<SVG> | ||
<Path d="M5 4v3h5.5v12h3V7H19V4z" /> | ||
</SVG> |
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.
For the protocol, I found these T
s a bit confusing before, and I find them confusing again - from the perspective of someone getting familiar with the component. I wonder if we can make it clearer as to what we're doing here. Maybe add some inline comments. Just trying to put myself into the shoes of someone not familiar at all with our components library.
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.
Part of #35665
What?
Remove the Knobs add-on from
Icon
stories. I've also converted the file to TypeScript since the component is already typed.Why?
This is now a blocker for supporting npm 8 (#46443).
How?
Just a quick, minimal refactor.
Testing Instructions
npm run storybook:dev
Components / Icon
component. (Careful, there is also aIcons / Icon
component 🙃)