-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add left panel hierarchy support #1329
Add left panel hierarchy support #1329
Conversation
Codecov Report
@@ Coverage Diff @@
## 151-story-hierarchy #1329 +/- ##
======================================================
+ Coverage 13.75% 14.66% +0.9%
======================================================
Files 202 203 +1
Lines 4623 4713 +90
Branches 616 512 -104
======================================================
+ Hits 636 691 +55
- Misses 3453 3591 +138
+ Partials 534 431 -103
Continue to review full report at Codecov.
|
@igor-dv Thanks for this implementation! I played with this solution and found some issues:
storiesOf('Atoms.Moleculs', module)
.add('with text', () => <Button>Hello Button</Button>)
.add('with some emoji', () => <Button>😀 😎 👍 💯</Button>)
storiesOf('Atoms.Moleculs.Cells', module)
.add('with text2', () => <Button>Hello Button</Button>)
.add('with some emoji2', () => <Button>😀 😎 👍 💯</Button>) expected behavior: show only one item with stories and a substory item
storiesOf('Atoms.Moleculs.Cells.simple', module)
.add('with text', () => <Button>Hello Button</Button>)
.add('with some emoji', () => <Button>😀 😎 👍 💯</Button>)
storiesOf('Atoms.Moleculs.Cells.more', module)
.add('with text2', () => <Button>Hello Button</Button>)
.add('with some emoji2', () => <Button>😀 😎 👍 💯</Button>)
storiesOf('Atoms.Moleculs', module)
.add('with text', () => <Button>Hello Button</Button>)
.add('with some emoji', () => <Button>😀 😎 👍 💯</Button>)
storiesOf('Atoms.Moleculs.Cells', module)
.add('with text2', () => <Button>Hello Button</Button>)
.add('with some emoji2', () => <Button>😀 😎 👍 💯</Button>) When I click possible it's overwhelming case thought :) My suggestionIn general, I like this solution. In order to succeed with this feature don't you mind to collaborate with storybook-addon-chapters wich provides hierarchy as well but in another way? And possible with other developers who'd like to jump to this feature. So we can create a separate branch for this feature and continue the work. |
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.
see some issues above
My bad I clicked the wrong button xD |
Full disclosure. I'm working a moving the ui to redux instead of mantra. While doing this I am making a hierarchical view to. I think we should merge @igor-dv PR because my work is not ready yet. I'll open a PR so @igor-dv can look at it and the kirks I had to handle to make the hierarchy work has I wanted (Hoping this will help you with fix bugs :)) If you want to have a look I'm opening a PR #1334 |
@usulpro , thanks for your review. Regarding the issues:
Regarding the storybook-addon-chapters. I've considered it as an alternative for the projects in a company I work, but it didn't meet our needs.
In general, I think that the left panel should look like most of the IDEs files explorer (or how it's called..) Though I am big fan of the plugins idea, Storybok addons api doesn't allow us to create a proper addon for the left panel.. Anyway, I think it's a great plugin, and would like to help with it. |
Conflicts: lib/ui/package.json
@igor-dv my guess is that "toggle story hierarchy" is gratuitous. My guess is that we release this as a backwards-compatible feature in 3.2 and then, assuming lots of people use it, we just make it the default in 4.0. |
@igor-dv I think it would be nice to be able to pass a function that constructs the hierarchy from the story name. So by default that would be Use cases:
|
@shilman like by default it's a boolean - but in a more expanded way it's uiOptions.leftPanelHierarchy = {
enabled: true,
split: story => (storyName) => storyName.split(".")
} WDYT ? |
@igor-dv another idea (don't know if it's a good one): Existing behavior (default):
New behavior:
|
I'm picky but I'm not sur about using 'Kind1.Kind2' In my opinion |
@alexandrebodin I don't have a strong opinion about this, but |
That works.. but toggling became harder to handle.. I need to add something to state.. @alexandrebodin |
@igor-dv why do we need toggling? Also, this may be out of scope, but how hard would it be to replace the left panel with a generic tree widget, such as react-treebeard with custom styles and key-bindings. I think Storybook's custom list UI kind of made sense when it was a flat list, but now that we have hierarchy, there are already common UI's for dealing with this that everybody (including non-engineers) are used to using. |
|
||
// Atomic | ||
|
||
storiesOf('Atoms.Molecules.Cells.simple', module) |
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 the order is backwards: Cells.Molecules.Atoms?
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.
possible we could get our existing kitchen-sink stuff and reorganize in a hierarchical way?
@@ -78,25 +78,62 @@ export default class ReactProvider extends Provider { | |||
this.api = api; | |||
this.api.setOptions({ | |||
name: 'REACT-STORYBOOK', | |||
sortStoriesByKind: true, |
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.
"breaking"?
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.
@shilman treebeard - interesting, I'll check it.. |
I think a better name will be uiOptions = {
resolveStoryHierarchyNamespace: (storyName) => [storyName]
} |
@igor-dv how about just |
@igor-dv I'm loving this! This is amazing! |
NOTE: merged this into |
Issue:
Substories/Hierarchy #151
What I did
I've added the option to visualize the "namespace syntax" of stories as a hierarchy in the stories panel (left panel).
For example, by providing stories like these:
The left panel will be like this:
You'll be able to control it by defining the new "leftPanelHierarchy" prop of the uiOptions as a true (by default it's false).
How to test
You can run the storybook/lib/ui/example