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

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/core/.storybook/manager.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { addons } from "@storybook/manager-api";
import React from "react";
import { addons } from "@storybook/manager-api";
import { SidebarItem } from "vibe-storybook-components";
import "vibe-storybook-components/index.css";
import theme from "./theme";
import isChromatic from "chromatic/isChromatic";

window.STORYBOOK_GA_ID = "UA-308574295";
window.STORYBOOK_REACT_GA_OPTIONS = {};
Expand All @@ -24,6 +25,16 @@ addons.setConfig({
}

return <SidebarItem status={parameters.status}>{name.replace(storyStatus, "").trim()}</SidebarItem>;
},
filters: {
patterns: filterStory
}
}
});

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!

const isDev = isChromatic() || process.env.NODE_ENV === "development";
const isInternal = !item.tags?.includes?.("internal") && !item.title?.startsWith?.("Internal");
return isDev || isInternal;
}
1 change: 1 addition & 0 deletions packages/core/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const preview: Preview = {
"Catalog",
"Change Log",
"Typography Migration Guide",
"Internal",
"Foundations",
"Buttons",
"Inputs",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { CatalogTemplate } from "./Catalog/Catalog.stories.templates";

export default {
title: "Catalog"
title: "Catalog",
tags: ["internal"]
};

export const Catalog = {
Expand Down