generated from wednesday-solutions/react-template
-
Notifications
You must be signed in to change notification settings - Fork 13
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
refactor: migrate storybook from v5 to v8 and update component stories #51
Open
ShriD2003
wants to merge
10
commits into
wednesday-solutions:master
Choose a base branch
from
ShriD2003:update/storybook
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ecf3b11
refactor: storybook config
ShriD2003 928b0af
refactor: rm older stories
ShriD2003 f2dcd4e
refactor: configuration for storybook
ShriD2003 ee61f79
refactor: migrate storybookv5 to v8
ShriD2003 ea3b5e0
refactor: add intl config for storybook
ShriD2003 5cb4cd9
chore: resolve conflicts
ShriD2003 2076212
chore: delete config.js
ShriD2003 1cafb90
update: Refactor Storybook configuration and dependencies
ShriD2003 07a7757
update: add test runner to run story test
ShriD2003 9cadaa5
ci: add accessibility tests to pipeline
ShriD2003 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
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 |
---|---|---|
|
@@ -13,4 +13,5 @@ reports/ | |
.DS_Store | ||
npm-debug.log | ||
.idea | ||
.tsconfig-lint.json | ||
.tsconfig-lint.json | ||
*storybook.log |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
import type { StorybookConfig } from '@storybook/react-webpack5'; | ||
|
||
const config: StorybookConfig = { | ||
addons: [ | ||
'@storybook/addon-webpack5-compiler-swc', | ||
'@storybook/addon-onboarding', | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@chromatic-com/storybook', | ||
'@storybook/addon-interactions', | ||
'@storybook/addon-a11y', | ||
'@bumped-inc/storybook-addon-lingui-v3', | ||
'@storybook/addon-docs', | ||
'@storybook/addon-controls' | ||
], | ||
docs: { | ||
autodocs: true | ||
}, | ||
framework: { | ||
name: '@storybook/react-webpack5', | ||
options: {} | ||
}, | ||
core: { | ||
builder: '@storybook/builder-webpack5' | ||
}, | ||
stories: ['../app/components/**/stories/**/*.mdx', '../app/components/**/stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'] | ||
}; | ||
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,27 @@ | ||
import enMessages from '../app/translations/en.json'; | ||
import { I18nProvider } from '@lingui/react'; | ||
import { i18n } from '@lingui/core'; | ||
import React from 'react'; | ||
|
||
i18n.load('en', enMessages); | ||
i18n.activate('en'); | ||
|
||
export const parameters = { | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/ | ||
} | ||
} | ||
}; | ||
|
||
export const decorators = [ | ||
(Story: React.FC) => { | ||
return ( | ||
<I18nProvider i18n={i18n}> | ||
<Story /> | ||
</I18nProvider> | ||
); | ||
} | ||
]; |
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,22 @@ | ||
import type { TestRunnerConfig } from '@storybook/test-runner'; | ||
import { injectAxe, checkA11y } from 'axe-playwright'; | ||
|
||
/* | ||
* See https://storybook.js.org/docs/writing-tests/test-runner#test-hook-api | ||
* to learn more about the test-runner hooks API. | ||
*/ | ||
const config: TestRunnerConfig = { | ||
async preVisit(page) { | ||
await injectAxe(page); | ||
}, | ||
async postVisit(page) { | ||
await checkA11y(page, '#storybook-root', { | ||
detailedReport: true, | ||
detailedReportOptions: { | ||
html: true | ||
} | ||
}); | ||
} | ||
}; | ||
|
||
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
This file was deleted.
Oops, something went wrong.
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,13 @@ | ||
import React from 'react'; | ||
import { Meta, Story } from '@storybook/react'; | ||
import { Clickable } from '../index'; | ||
|
||
export default { | ||
title: 'Clickable', | ||
component: Clickable | ||
}; | ||
|
||
const ClickableTemplate = (args) => <Clickable {...args} />; | ||
|
||
export const ClickableStoryComponent = ClickableTemplate.bind({}); | ||
ClickableStoryComponent.args = {}; |
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,14 +1,19 @@ | ||
/** | ||
* | ||
* Stories for Header | ||
* | ||
* @see https://github.com/storybookjs/storybook | ||
* | ||
*/ | ||
|
||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { text } from '@storybook/addon-knobs'; | ||
import { MemoryRouter } from 'react-router-dom'; | ||
import Header from '../index'; | ||
|
||
storiesOf('Header').add('simple', () => <Header id={text('id', 'Header')} />); | ||
export default { | ||
title: 'Header', | ||
component: Header | ||
}; | ||
|
||
const HeaderTemplate = (args) => ( | ||
<MemoryRouter> | ||
<Header {...args} /> | ||
</MemoryRouter> | ||
); | ||
|
||
export const HeaderStoryComponent = HeaderTemplate.bind({}); | ||
HeaderStoryComponent.args = { | ||
id: 'Header' | ||
}; |
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,28 +1,27 @@ | ||
/** | ||
* | ||
* Stories for LaunchList | ||
* | ||
* @see https://github.com/storybookjs/storybook | ||
* | ||
*/ | ||
|
||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { LaunchList } from '../index'; | ||
import LaunchList from '../index'; | ||
|
||
const loading = false; | ||
const launchData = { | ||
launches: [ | ||
{ | ||
id: '1', | ||
launchDateUtc: '2014-01-06T14:06:00', | ||
missionName: 'Thaicom 6', | ||
links: { | ||
wikipedia: 'https://en.wikipedia.org/wiki/Thaicom_6', | ||
flickrImages: ['https://farm9.staticflickr.com/8617/16789019815_f99a165dc5_o.jpg'] | ||
} | ||
} | ||
] | ||
export default { | ||
title: 'LaunchList', | ||
component: LaunchList | ||
}; | ||
|
||
storiesOf('LaunchList').add('simple', () => <LaunchList launchData={launchData} loading={loading} />); | ||
const LaunchListTemplate = (args) => <LaunchList {...args} />; | ||
|
||
export const LaunchListStoryComponent = LaunchListTemplate.bind({}); | ||
LaunchListStoryComponent.args = { | ||
launchData: { | ||
launches: [ | ||
{ | ||
id: '1', | ||
launchDateUtc: '2014-01-06T14:06:00', | ||
missionName: 'Thaicom 6', | ||
links: { | ||
wikipedia: 'https://en.wikipedia.org/wiki/Thaicom_6', | ||
flickrImages: ['https://farm9.staticflickr.com/8617/16789019815_f99a165dc5_o.jpg'] | ||
} | ||
} | ||
] | ||
}, | ||
loading: false | ||
}; |
This file was deleted.
Oops, something went wrong.
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
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.
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.
This is removed because the doc generation is done by default on the new version ?
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.
Yes , Post v6 doc-gen support is by default.