Skip to content

Commit

Permalink
Merge pull request #14 from uswds/jm/add-storybook
Browse files Browse the repository at this point in the history
USWDS-Next - Storybook: Add initial implementation
  • Loading branch information
mejiaj authored Jun 14, 2024
2 parents c81a96b + 41ec42b commit 56fbec4
Show file tree
Hide file tree
Showing 12 changed files with 11,904 additions and 1,597 deletions.
2 changes: 2 additions & 0 deletions web-components/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?

*storybook.log
10 changes: 10 additions & 0 deletions web-components/.storybook/UswdsTheme.js
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',
});
5 changes: 5 additions & 0 deletions web-components/.storybook/index.css
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;
}
17 changes: 17 additions & 0 deletions web-components/.storybook/main.js
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;
6 changes: 6 additions & 0 deletions web-components/.storybook/manager.js
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,
});
28 changes: 28 additions & 0 deletions web-components/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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;
Loading

0 comments on commit 56fbec4

Please sign in to comment.