-
-
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
WIP: key and value for select knob match key/value of options #1449
Conversation
597827d
to
3eb873b
Compare
Codecov Report
@@ Coverage Diff @@
## master #1449 +/- ##
=========================================
Coverage ? 20.69%
=========================================
Files ? 249
Lines ? 5585
Branches ? 666
=========================================
Hits ? 1156
Misses ? 3933
Partials ? 496
Continue to review full report at Codecov.
|
@psimyn @ndelangen how do we want to release this breaking change?
|
@shilman I'd like it in stable as soon as possible. On the fence about breaking semver, I'm not using knobs addon for anything critical. I addon package are supposed to stay at same version as main repo? |
We release all packages with the same major. This IS a breaking api change. this SHOULD be a major version. BUT keeping this from users until Can we think about toggling this behavior somehow? |
@psimyn regarding stability, it's about the thousands of companies and developers using storybook, not whether you're using it for anything critical 😉 I propose we put it into 3.2, which should be a pretty good release. It's not strict semver, but at least people will be getting something for upgrading with a breaking change. Another option would be to fix some stuff with the addons API and rename 3.2 to 4.0. Not ideal, but especially if we could get Angular2 in there, it would be a great release! |
What about to backward-compatible it ? For example crate a new |
@igor-dv can you explain in more detail what you are thinking? So we put this into a Select_next.js and then enable it using some kind of feature flag |
@shilman , exactly, I couldn't describe it better ;) |
Would it be ok to override for each select?.
@igor-dv @shilman if global setting is better can you please point me to somewhere else that does it? I wasn't sure where to store global options |
Good work @psimyn !!! My first idea would be to export an additional |
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 would be fine for 4.0.0
but that's some ways off I think.
Like I suggested, let's find a way to support both until 4.0.0
!
Do I understand this PR correctly. Will this be possible after this gets merged? const SomeComponent = ({ icon: Icon }) => (
<div className="some-component">
{Icon && <Icon className="some-component__icon" />}
</div>
);
const MailIcon = props => <img {...props} src="/some/path/mail.png" />;
const LockIcon = props => <img {...props} src="/some/path/lock.png" />;
<SomeComponent
icon={select('Icon', {
"None": null,
"Mail": MailIcon, // React component
"Lock": LockIcon, // React component
})}
/> If so when will this be added? It's a really good feature! ❤️ |
Just figured out how todo the same behaviour right now. const icons = {
None: null,
MailIcon,
LockIcon,
};
<SomeComponent
icon={icons[select('Icon', Object.keys(icons)]}
/> |
What we can do without breaking (almost) anything is support an "array of objects" syntax, which is more verbose, but also more explicit:
|
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.
Code LGTM,
We need to agree on a release strategy
I had some craziness happen with remotes, so I created #1745 Adds |
fixes #799
Breaking change
Issue:
Using knobs is currently confusing.
Example, for complex strings and null values
What I did
Use value as value
Still uses key for the key property on each
<option>
How to test
Will add some tests. Is there a preference between
__tests__
folder and*.test.js
?