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

USWDS-Next - Storybook: Add initial implementation #14

Merged
merged 19 commits into from
Jun 14, 2024
Merged

Conversation

mejiaj
Copy link
Collaborator

@mejiaj mejiaj commented Jun 7, 2024

Closes #6.

Blocked by #8.

Initial setup of StorybookJS in repo. Includes a few examples for:

  • Custom docs with MDX.
  • Embedding existing MD content.
  • Autogenerated docs.
  • Component previews.

Also created a small custom theme called UswdsTheme.js to use Public Sans, bump up default font size, and use some USWDS colors.

Welcome page
Includes an example of what custom documentation using Storybook blocks looks like.
image

Embedded README
Example of embedding an existing README into page. Could be used for CHANGELOGs.
image

Component docs
Autogenerated component docs.
image

Component preview
Example of importing Lit component with configurable props.
image

How to test

  1. Go into web-components directory.
  2. Run npm install.
  3. Run npm start.

You should have a working storybook library powered by Vite.

mejiaj added 14 commits June 7, 2024 14:38
Based on default light theme. This is the recommended way of updating the title and setting some baseline defaults for Storybook UI.

**Note**
Setting a brand image will completely replace the text. Potential workaround here if we really want logo + text - storybookjs/storybook#5866 (comment)
Added to load fonts locally, but seems like its intended for including assets in final build.
- Update title
- Add basic USWDS colors
@mejiaj mejiaj marked this pull request as ready for review June 10, 2024 20:42
@mejiaj
Copy link
Collaborator Author

mejiaj commented Jun 12, 2024

Docs update

I've enabled source code by default [0523b65] to avoid having to click on each variant for markup.

Before After
image image

Copy link
Collaborator

@heymatthenry heymatthenry left a comment

Choose a reason for hiding this comment

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

Thanks for putting this all together! This will be a huge help.

toc: true, // Autogenerate table of contents.
theme: UswdsTheme,
canvas: {
sourceState: 'shown'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note

Not a blocker, but indentation can be off in some previews. There's a workaround in this issue DocsPage code preview indentation is wrong · Issue #8078 · storybookjs/storybook.

Choose a reason for hiding this comment

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

FYI, I got this working on the MD WDS project I'm working on!

Here are my notes on the workaround:
storybookjs/storybook#8078 (comment)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@caseywatts thanks for sharing. Created an issue to give this a try 😄

Copy link
Contributor

@mahoneycm mahoneycm left a comment

Choose a reason for hiding this comment

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

Thanks so much for doing this! Pulled it into the card component work and it's working like a charm. One small comment for quote consistency on the stories page but not a blocker

web-components/src/components/usa-link/link.stories.js Outdated Show resolved Hide resolved
@mejiaj mejiaj merged commit 56fbec4 into develop Jun 14, 2024
2 checks passed
@mejiaj mejiaj deleted the jm/add-storybook branch June 14, 2024 14:58
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.

Configure Storybook
4 participants