-
-
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
Fix #4829: render non-grouped knobs in the ALL tab #5106
Conversation
|
||
const titles = wrapper | ||
.find(TabsState) | ||
// TabsState will replace the <div/> that Panel actually makes with a <Tab/> |
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.
The way TabsState works is, tbh, scary 😓
It's not even possible to refactor the objects with render
/ title
into a component (which would be way cleaner) because that'd break TabsState looking into its children.
I assume it's a relic from a world before render props.
(<TabsState>
{({ active, selected }) =>
Object.keys(groups).map(groupName => (
<KnobsTab
key={groupName}
active={active || selected === DEFAULT_GROUP_ID}
name={groupName}
knobs={knobsArray.filter(/* ... */)}
/* ... */
/>
))
}
</TabsState>)
function KnobsTab({ active, name, knobs /* ... */ }) {
return (
<Tab id={name} title={name}>
<TabWrapper active={active}>
...
</TabWrapper>
</Tab>
)
}
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.
Would be happy to chat about how to improve this, Are you on the Storybook discord by any chance?
Also it should be rebased on |
I'll rebase this |
Codecov Report
@@ Coverage Diff @@
## next #5106 +/- ##
==========================================
+ Coverage 35.02% 35.32% +0.29%
==========================================
Files 596 596
Lines 7371 7375 +4
Branches 1005 1012 +7
==========================================
+ Hits 2582 2605 +23
+ Misses 4277 4260 -17
+ Partials 512 510 -2
Continue to review full report at Codecov.
|
268c9cf
to
b31a405
Compare
OK it's rebased, and I took the liberty of applying the changes for @igor-dv review comments. @Kovensky we're migrating to typescript, and we're discussing how the future version of addon-knobs is going to look like / function on discord. I'd love your input on it, and help if you can. 🙇 |
Fix #4829: render non-grouped knobs in the ALL tab
Issue: #4829
What I did
When there are knobs both with and without a
groupId
, the knobs without agroupId
were not getting rendered at all.I made them be rendered as part of the content of the (normally contentless)
ALL
tab.How to test
PS: Oops, I only saw the notice about which branch to use as base after I wrote this. I need this to be in
master
FWIW. What do?