-
-
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
Feature/add data-tags attribute to sidebar items #10169
Closed
thehuijb
wants to merge
316
commits into
storybookjs:next
from
thehuijb:feature-provide-means-for-tagging-stories
Closed
Feature/add data-tags attribute to sidebar items #10169
thehuijb
wants to merge
316
commits into
storybookjs:next
from
thehuijb:feature-provide-means-for-tagging-stories
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # lib/addons/package.json # lib/core/package.json
This reverts commit b227f77.
…D indicators to Sidebar
fix storySort docs: rename 'sort' to 'order'
…m:thehuijb/storybook into feature-provide-means-for-tagging-stories # Conflicts: # lib/api/src/lib/stories.ts # lib/ui/src/components/sidebar/SidebarStories.tsx # lib/ui/src/components/sidebar/Tree/ListItem.tsx # lib/ui/src/components/sidebar/treeview/treeview.tsx
thehuijb
requested review from
aaronmcadam,
alexandrebodin,
CodeByAlex,
dangreenisrael,
danielduan,
jbovenschen,
kazupon,
leonrodenburg,
thani-sh,
renaudtertrais,
saponifi3d,
stijnkoopal,
thomasbertet,
usulpro and
z4o4z
as code owners
March 26, 2020 12:57
How come this PR has 316 commits & 200+ files changed? |
good question, how did that happen? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: 9209 Add an option to hide a story from the sidebar
What I did
I made an adjustment to how stories are written out to the sidebar to include a
data-tags
attribute which defaults todata-tags="none"
the tags can then be used to show or hide stories based on plain css selectors:
for instance one could add a rule to hide all stories with
data-tags="hidden"
:or more complex to hide all stories that do not have a certain TAG so you could show just the stories that belong to that TAG:
to add the tags to the stories you only need to add it to the default like so:
or to a specific story like this:
you can specify multiple tags using the pipe symbol
|
e.g.tags: 'web|app'
to specify that the component or story belongs to theweb
and to theapp
if you would add
tags: 'web|app'
to default and then addtags: 'web'
to a story andtags: 'app'
to another, one could show and hide different stories based on a selected TAGif components are created under the same branch, the branch will receive the tags from all component and pipe
|
them together e.g. if one storyfile hasand another storyfile has
the resulting link in the sidebar to
Category
will havedata-tags="web|app"
How to test
tags: 'hidden'
to one of the stories files like described abovedata-tags
attibutesIf your answer is yes to any of these, please make sure to include it in your PR.