Skip to content
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

docs: allow having Internal section with stories only visible for dev mode #2062

Conversation

YossiSaadi
Copy link
Contributor

@YossiSaadi YossiSaadi commented Apr 11, 2024

}
}
});

function filterInternalStoryDocsPage(item) {
return process.env.STORYBOOK_ENV === "development" || !item.tags?.includes?.("internal");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we filter the entire section without the tags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basically, we can say that if the name includes Internal.
I could add it as an extra check, and leave the current, just for cases where if we would like to have an internal story inside an existing category. wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should work also with internals stories, no? Anyway I think it's fine for now with tags. It's a new feature in SB7 no? We can use them for the beta/deprecated tags as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • yep it is
  • you mean adding styled tags?
  • and if I remove the check for tags and only exclude the Internal category, then it won't exclude internal stories that are inside regular (exported) categories

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I mean the sidebar tags, we use the name to decide whether a story is a beta or deprecated, I think using tags is better for that purpose. Let's stay with tags, forget about what I said 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhh I got you
TechDebt task 🙃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}
});

function filterInternalStoryDocsPage(item) {
return process.env.STORYBOOK_ENV === "development" || !item.tags?.includes?.("internal");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storybook uses env variables, I think you can get them somehow here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to also use their support, and their docs, couldn't find anything related

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would love to know if you find something, I'll change it 🙏🏼

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use process.env.NODE_ENV

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are they setting it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes tried it locally also, and they use production for build

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do they supply in dev?
I'm not sure if we're exporting as production build

@YossiSaadi YossiSaadi requested a review from talkor April 15, 2024 07:45
Copy link
Member

@talkor talkor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, just remove the console

}
}
});

function filterStory(item) {
console.log(process.env.NODE_ENV === "development", item.title, ...item.tags, { item });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@YossiSaadi YossiSaadi merged commit e395bc1 into master Apr 15, 2024
9 of 10 checks passed
@YossiSaadi YossiSaadi deleted the docs/yossi/Allow-hiding-internal-stories-in-Storybooks-sidebar-6437258196 branch April 15, 2024 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants