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

Decouple Storybook from docs #305

Merged
merged 4 commits into from
May 17, 2019

Conversation

i-like-robots
Copy link
Contributor

@i-like-robots i-like-robots commented May 17, 2019

This change prevents the Gatsby from loading story files and component source files.

The change is required because #275 enabled component stories to include source files instead of restricting them to the distributable code bundle and Gatsby may break if it attempts to load these files.

To achieve this I have added ignore rules to the filesystem plugin and refactored the package page logic to check only if component story files exist but actually load it.

This limits the UI somewhat, so I have made it simpler by removing the individual story tabs and simply enabling Storybook links if a story file is found.

Please note:

@i-like-robots i-like-robots added documentation A problem with how something is documented (or, not) housekeeping Cleaning things up labels May 17, 2019
class StoryViewer extends React.Component {
constructor(props) {
super(props);
const StoryViewer = ({ name }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

niiiice

@robsquires
Copy link
Contributor

LGTM

robsquires
robsquires previously approved these changes May 17, 2019
@@ -22,7 +22,7 @@ export default ({ name, manifest, storybook }) => (
</li>
{storybook ? (
<li className="tertiary-menu__item">
<Link to={`/storybook/index.html?selectedKind=${name}`} {...linkProps}>
<Link to={`/storybook/index.html?path=/story/${name}--*`} {...linkProps}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This requires Storybook 5.1.0 (when it is available)

<div id="component-demos" className="story-viewer">
<h2 className="story-viewer__heading">Component demos</h2>
<div className="story-viewer__panel">
<iframe title={`${name} demo`} src={iframeUrl}></iframe>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gatsby won't be able to serve this static file when in develop mode as it uses a .html extension.

@i-like-robots i-like-robots merged commit 19c0341 into master May 17, 2019
@i-like-robots i-like-robots deleted the matth/decouple-storybook-from-docs branch May 17, 2019 13:40
rowanbeentje pushed a commit that referenced this pull request Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation A problem with how something is documented (or, not) housekeeping Cleaning things up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants