This repository has been archived by the owner on Dec 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migration: upgrade storybook to ver. 7 (#534)
## Description Upgrade project to Storybook 7, https://storybook.js.org/releases/7.0. During this migration, I've removed a large number of hard-coded stories. It would be better to reconstruct with simpler stories. ## Tests Not breaking previous tests. ## Checklist Before you create this PR confirms that it meets all requirements listed below by checking the relevant checkboxes (`[x]`). This will ensure a smooth and quick review process. - [x] I read the [Contributor Guide](https://github.com/dooboolab-community/dooboo-ui/blob/main/CONTRIBUTING.md) and followed the process outlined there for submitting PRs. - [x] Run `yarn test:all` and make sure nothing fails. - [x] I am willing to follow-up on review comments in a timely manner.
- Loading branch information
Showing
94 changed files
with
3,782 additions
and
5,511 deletions.
There are no files selected for viewing
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,19 @@ | ||
/** @type{import("@storybook/react-webpack5").StorybookConfig} */ | ||
module.exports = { | ||
stories: [ | ||
"../stories/**/*.stories.mdx", | ||
"../stories/**/*.stories.@(js|jsx|ts|tsx)", | ||
], | ||
addons: [ | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@storybook/addon-react-native-web", | ||
], | ||
framework: { | ||
name: "@storybook/react-webpack5", | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: true, | ||
}, | ||
}; |
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 type { Preview } from "@storybook/react"; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
}, | ||
}; |
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,32 +1,92 @@ | ||
import '@storybook/addon-ondevice-notes/register'; | ||
import '@storybook/addon-ondevice-controls/register'; | ||
import '@storybook/addon-ondevice-backgrounds/register'; | ||
import '@storybook/addon-ondevice-actions/register'; | ||
import '@expo/match-media'; | ||
import './storybook/addons'; | ||
|
||
import AsyncStorage from '@react-native-async-storage/async-storage'; | ||
import {configure, getStorybookUI} from '@storybook/react-native'; | ||
import {withBackgrounds} from '@storybook/addon-ondevice-backgrounds'; | ||
import type {Preview} from '@storybook/react'; | ||
import {start} from '@storybook/react-native'; | ||
|
||
const storiesOfUIs = require.context('./stories/uis', true, /\.stories\.tsx$/); | ||
const stories: Parameters<typeof start>[0]['storyEntries'] = [ | ||
{ | ||
titlePrefix: 'UI', | ||
directory: './stories/uis', | ||
files: '**/*.stories.?(ts|tsx|js|jsx)', | ||
importPathMatcher: | ||
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/, | ||
// @ts-ignore | ||
req: require.context( | ||
'./stories/uis', | ||
true, | ||
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/, | ||
), | ||
}, | ||
{ | ||
titlePrefix: 'Modal', | ||
directory: './stories/modals', | ||
files: '**/*.stories.?(ts|tsx|js|jsx)', | ||
importPathMatcher: | ||
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/, | ||
// @ts-ignore | ||
req: require.context( | ||
'./stories/modals', | ||
true, | ||
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/, | ||
), | ||
}, | ||
{ | ||
titlePrefix: 'Package', | ||
directory: './stories/packages', | ||
files: '**/*.stories.?(ts|tsx|js|jsx)', | ||
importPathMatcher: | ||
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/, | ||
// @ts-ignore | ||
req: require.context( | ||
'./stories/packages', | ||
true, | ||
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/, | ||
), | ||
}, | ||
]; | ||
|
||
const storiesOfModals = require.context( | ||
'./stories/modals', | ||
true, | ||
/\.stories\.tsx$/, | ||
); | ||
// @ts-ignore | ||
global.STORIES = stories; | ||
|
||
const storiesOfPackages = require.context( | ||
'./stories/packages', | ||
true, | ||
/\.stories\.tsx$/, | ||
); | ||
|
||
const getStories = (): any => { | ||
storiesOfUIs.keys().forEach((filename) => storiesOfUIs(filename)); | ||
storiesOfModals.keys().forEach((filename) => storiesOfModals(filename)); | ||
storiesOfPackages.keys().forEach((filename) => storiesOfPackages(filename)); | ||
const preview: Preview = { | ||
decorators: [withBackgrounds], | ||
parameters: { | ||
backgrounds: { | ||
default: 'plain', | ||
values: [ | ||
{name: 'plain', value: 'white'}, | ||
{name: 'warm', value: 'hotpink'}, | ||
{name: 'cool', value: 'deepskyblue'}, | ||
], | ||
}, | ||
actions: {argTypesRegex: '^on[A-Z].*'}, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
configure(getStories, module); | ||
const view = start({ | ||
annotations: [ | ||
preview, | ||
require('@storybook/react-native/dist/preview'), | ||
require('@storybook/addon-actions/preview'), | ||
], | ||
storyEntries: global.STORIES, | ||
}); | ||
|
||
export default getStorybookUI({ | ||
// @ts-ignore | ||
asyncStorage: AsyncStorage, | ||
export default view.getStorybookUI({ | ||
storage: { | ||
getItem: AsyncStorage.getItem, | ||
setItem: AsyncStorage.setItem, | ||
}, | ||
}); |
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
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
Oops, something went wrong.