-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Primer Storybook #318
Primer Storybook #318
Conversation
@broccolini I think I figured out the magical sass and postcss incantations:
As of 75fb852, it works for me without any build errors! |
@shawnbot Yissss! Pulled it down and tested a sass changed and it worked! It's not super fast but does apply the changes without re-fresh. Not sure how fast it should be though. Still, it's fast enough and gives us a way to see style changes while we're making updates which is rad. I'll work on adding stories for the rest of the components and will check in with you and @jonrohan about next steps. |
It might be worth looking at whether Storybook has hooks for rebuilding assets outside of webpack, because I have a feeling that's what's so slow. But for now, onward and upward! |
It was definitely faster before adding the sass loader etc. so yeah perhaps there's a better way to configure this. But happy to work with this for now :) |
input-group, form-actions, label highlight, form-checkbox-details, and form-group
@shawnbot and I had a chat and decided it's worth merging this in so we can all use it while adding new components, I'll make a tracking issue and continue to add the remaining stories. In this pr I've added the following:
I also added an addon so we can have it say "Primer" in the top left and link back to primer.io. Story structureSome guidelines for the story structure:
You can, for the most part, copy+paste examples from the README docs, depending on their quality. Some tips in case you're not familiar with jsx:
I did not copy every example to a story if it was not part of the component or overkill on examples. While I was doing this is highlighted some of the inconsistencies in our style guide, and how some examples are kind of muddled together or don't use great example copy, or are missing altogether. I started making a list to follow up but didn't want to make changes to readme's in this bigg-ish pr. To do(which @shawnbot has offered to help with)
cc @primer/ds-core |
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.
💥
I added a real quick and dirty octicons story (cc @jonrohan) and the 👏 @broccolini 👏 |
Setting up Storybook for testing changes to Primer styles within the Primer repo. We have a couple of projects coming up and no easy way to view how changes to Primer look while we're working in the Primer repo. This was pretty quick to setup and since it's got a fair amount of support I figure it's worth testing. If it ends up not being the right thing for us that's fine, but hoping it can be a quick-fix solution to tide us over for the up-coming projects.
To test locally I think you just need to do an
npm install
, andnpm start
will run storybook.Issue with Sass imports
@import
with a~
but obviously that would conflict withprimer-module-build
.~
. That's not a great long-term fix but might tide us over for the short term.Here's the docs on the custom webpack config I used to setup the sass loaders https://storybook.js.org/configurations/custom-webpack-config/
Future thoughts
Story setup
If we can resolve the Sass import issue without too much trouble I'll add stories for the rest of the components. Happy to discuss story setup, but my general thoughts were we have 1 story per component, if that component has states then show them in the same view. I feel unsure about modifiers and elements so want to take a look at other storybook's. Here's a couple of examples:
cc @primer/ds-core