generated from storybookjs/addon-kit
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from storybookjs/build/upgrade-storybook-examples
Update Storybook examples
- Loading branch information
Showing
25 changed files
with
28,269 additions
and
27,096 deletions.
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
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,39 @@ | ||
name: Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Enable Corepack | ||
run: corepack enable | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
|
||
- name: Build coverage addon | ||
run: | | ||
yarn install | ||
yarn build | ||
- name: Run tests in webpack example | ||
run: | | ||
yarn install | ||
npx playwright install --with-deps | ||
yarn test-storybook:ci-coverage | ||
working-directory: examples/webpack5 | ||
|
||
- name: Run tests in vite example | ||
run: | | ||
yarn install | ||
npx playwright install --with-deps | ||
yarn test-storybook:ci-coverage | ||
working-directory: examples/vite | ||
|
||
- name: Generate code coverage | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
verbose: true |
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
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 @@ | ||
nodeLinker: node-modules |
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
7 changes: 3 additions & 4 deletions
7
examples/vite/.storybook/main.js → examples/vite/.storybook/main.ts
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 |
---|---|---|
@@ -1,15 +1,14 @@ | ||
module.exports = { | ||
export default { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"], | ||
|
||
addons: [ | ||
"@storybook/addon-essentials", | ||
"@storybook/addon-interactions", | ||
"@storybook/addon-coverage", | ||
], | ||
|
||
framework: { | ||
name: "@storybook/react-vite", | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: true, | ||
}, | ||
}; |
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
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 |
---|---|---|
|
@@ -8,28 +8,30 @@ | |
"build": "tsc && vite build", | ||
"preview": "vite preview", | ||
"storybook": "npx storybook dev -p 6006", | ||
"build-storybook": "npx storybook build" | ||
}, | ||
"resolutions": { | ||
"jackspeak": "2.1.1" | ||
"build-storybook": "npx storybook build", | ||
"test-storybook": "test-storybook --coverage", | ||
"test-storybook:ci-coverage": "concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"yarn build-storybook --quiet && npx serve storybook-static -l 6006\" \"wait-on tcp:6006 && yarn test-storybook --coverage\"" | ||
}, | ||
"dependencies": { | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@storybook/addon-essentials": "7.4.2", | ||
"@storybook/addon-interactions": "7.4.2", | ||
"@storybook/addon-coverage": "link:../..", | ||
"@storybook/react": "7.4.2", | ||
"@storybook/react-vite": "7.4.2", | ||
"@storybook/test-runner": "^0.13.0", | ||
"@storybook/testing-library": "^0.2.1", | ||
"@storybook/addon-coverage": "portal:../..", | ||
"@storybook/addon-essentials": "^8.4.7", | ||
"@storybook/addon-interactions": "^8.4.7", | ||
"@storybook/react": "^8.4.7", | ||
"@storybook/react-vite": "^8.4.7", | ||
"@storybook/test": "^8.4.7", | ||
"@storybook/test-runner": "^0.21.0", | ||
"@types/react": "^18.0.17", | ||
"@types/react-dom": "^18.0.6", | ||
"@vitejs/plugin-react": "^2.1.0", | ||
"storybook": "7.4.2", | ||
"@vitejs/plugin-react": "^3.1.0", | ||
"concurrently": "^9.1.0", | ||
"storybook": "^8.4.7", | ||
"typescript": "^4.6.4", | ||
"vite": "^4.2.1" | ||
} | ||
"vite": "^4.2.1", | ||
"wait-on": "^8.0.1" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
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 |
---|---|---|
@@ -1,41 +1,42 @@ | ||
import React from 'react'; | ||
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react'; | ||
import type { StoryFn, Meta } from "@storybook/react"; | ||
|
||
import { Button } from './Button'; | ||
import { Button } from "./Button"; | ||
|
||
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export | ||
export default { | ||
title: 'Example/Button', | ||
title: "Example/Button", | ||
component: Button, | ||
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
backgroundColor: { control: "color" }, | ||
}, | ||
} as ComponentMeta<typeof Button>; | ||
} as Meta<typeof Button>; | ||
|
||
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args | ||
const Template: ComponentStoryFn<typeof Button> = (args) => <Button {...args} />; | ||
const Template: StoryFn<typeof Button> = (args) => ( | ||
<Button {...args} /> | ||
); | ||
|
||
export const Primary = Template.bind({}); | ||
// More on args: https://storybook.js.org/docs/react/writing-stories/args | ||
Primary.args = { | ||
primary: true, | ||
label: 'Button', | ||
label: "Button", | ||
}; | ||
|
||
export const Secondary = Template.bind({}); | ||
Secondary.args = { | ||
label: 'Button', | ||
label: "Button", | ||
}; | ||
|
||
export const Large = Template.bind({}); | ||
Large.args = { | ||
size: 'large', | ||
label: 'Button', | ||
size: "large", | ||
label: "Button", | ||
}; | ||
|
||
export const Small = Template.bind({}); | ||
Small.args = { | ||
size: 'small', | ||
label: 'Button', | ||
size: "small", | ||
label: "Button", | ||
}; |
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
Oops, something went wrong.