-
Notifications
You must be signed in to change notification settings - Fork 6
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
Conversation
class StoryViewer extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
const StoryViewer = ({ name }) => { |
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.
niiiice
LGTM |
@@ -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}> |
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.
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> |
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.
Gatsby won't be able to serve this static file when in develop mode as it uses a .html
extension.
…-from-docs Decouple Storybook from docs
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:
.html
extension, [gatsby develop] Properly serve HTML files in the static directory gatsbyjs/gatsby#13072