-
Notifications
You must be signed in to change notification settings - Fork 12
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
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b2929f8
Storybook initial install.
1669478
Add `start` script with new port.
38439bb
Delete autogenerated extras.
b7e6b9d
Update story paths.
13bb88b
Bump up font size because 14px is tiny.
8d9e187
Create initial USWDS theme.
87219b3
Include Public Sans to vite config for Storybook.
1dcdef3
Create initial welcome doc.
0b77fce
Remove fonts from assetsInclude.
932598b
Add Public Sans font.
ec2d940
Storybook theme updates.
5e43756
Storybook use autodocs by default.
8b63c13
Create sample link story.
0da6d1d
Update base font size & create sample docs.
fa6a8d0
Merge branch 'mh/add-usa-link' of github.com:uswds/uswds-next into jm…
876d7fd
Merge branch 'develop' of github.com:uswds/uswds-next into jm/add-sto…
88c79d5
Add child link variant.
0523b65
Storybook Docs: Show markup by default.
41ec42b
Formatting fixes.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ dist-ssr | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
*storybook.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { create } from '@storybook/theming/create'; | ||
|
||
export default create({ | ||
base: 'light', | ||
brandTitle: "USWDS Next", | ||
fontBase: '"Public Sans Web", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', | ||
colorPrimary: '#4a77b4', | ||
colorSecondary: '#2672de', | ||
textColor: '#1b1b1b', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
:where(p:not(.sb-anchor, .sb-unstyled, .sb-unstyled p)), | ||
:where(li:not(.sb-anchor, .sb-unstyled, .sb-unstyled li)) { | ||
font-size: 22px !important; | ||
line-height: 1.4 !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** @type { import('@storybook/web-components-vite').StorybookConfig } */ | ||
const config = { | ||
stories: [ | ||
"../src/**/*.mdx", | ||
"../src/components/**/*.stories.@(js|jsx|mjs|ts|tsx)", | ||
], | ||
addons: [ | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@chromatic-com/storybook", | ||
], | ||
framework: { | ||
name: "@storybook/web-components-vite", | ||
options: {}, | ||
}, | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { addons } from '@storybook/manager-api'; | ||
import UswdsTheme from './UswdsTheme'; | ||
|
||
addons.setConfig({ | ||
theme: UswdsTheme, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import UswdsTheme from "./UswdsTheme"; | ||
|
||
// Global component styles. | ||
import "../src/index.css"; | ||
// Theme overrides. | ||
import "./index.css"; | ||
|
||
|
||
/** @type { import('@storybook/web-components').Preview } */ | ||
const preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
docs: { | ||
toc: true, // Autogenerate table of contents. | ||
theme: UswdsTheme, | ||
canvas: { | ||
sourceState: 'shown' | ||
} | ||
} | ||
}, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export default preview; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
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.
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)
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.
@caseywatts thanks for sharing. Created an issue to give this a try 😄