-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: initial Storybook setup * refactor: migrate existing sandbox to storybook * chore: remove last mentions of the old sandbox * chore: clean unused package * chore: add example env values for storybook
- Loading branch information
Showing
62 changed files
with
1,703 additions
and
810 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
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,11 @@ | ||
import AsyncStorage from '@react-native-async-storage/async-storage'; | ||
import { view } from './storybook.requires'; | ||
|
||
const StorybookUIRoot = view.getStorybookUI({ | ||
storage: { | ||
getItem: AsyncStorage.getItem, | ||
setItem: AsyncStorage.setItem, | ||
}, | ||
}); | ||
|
||
export default StorybookUIRoot; |
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,12 @@ | ||
import { StorybookConfig } from '@storybook/react-native'; | ||
|
||
const main: StorybookConfig = { | ||
stories: ['../src/**/*.stories.?(ts|tsx|js|jsx)'], | ||
addons: [ | ||
'@storybook/addon-ondevice-controls', | ||
'@storybook/addon-ondevice-backgrounds', | ||
'@storybook/addon-ondevice-actions', | ||
], | ||
}; | ||
|
||
export default main; |
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,25 @@ | ||
import { withBackgrounds } from '@storybook/addon-ondevice-backgrounds'; | ||
import type { Preview } from '@storybook/react'; | ||
|
||
const preview: Preview = { | ||
decorators: [withBackgrounds], | ||
|
||
parameters: { | ||
backgrounds: { | ||
default: 'dark', | ||
values: [ | ||
{ name: 'dark', value: '#1E1E1E' }, | ||
{ name: 'light', value: '#FFFFFF' }, | ||
], | ||
}, | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
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,50 @@ | ||
/* do not change this file, it is auto generated by storybook. */ | ||
|
||
import { start, updateView } from "@storybook/react-native"; | ||
|
||
import "@storybook/addon-ondevice-controls/register"; | ||
import "@storybook/addon-ondevice-backgrounds/register"; | ||
import "@storybook/addon-ondevice-actions/register"; | ||
|
||
const normalizedStories = [ | ||
{ | ||
titlePrefix: "", | ||
directory: "./src", | ||
files: "**/*.stories.?(ts|tsx|js|jsx)", | ||
importPathMatcher: | ||
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/, | ||
// @ts-ignore | ||
req: require.context( | ||
"../src", | ||
true, | ||
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/ | ||
), | ||
}, | ||
]; | ||
|
||
declare global { | ||
var view: ReturnType<typeof start>; | ||
var STORIES: typeof normalizedStories; | ||
} | ||
|
||
const annotations = [ | ||
require("./preview"), | ||
require("@storybook/react-native/preview"), | ||
require("@storybook/addon-ondevice-actions/preview"), | ||
]; | ||
|
||
global.STORIES = normalizedStories; | ||
|
||
// @ts-ignore | ||
module?.hot?.accept?.(); | ||
|
||
if (!global.view) { | ||
global.view = start({ | ||
annotations, | ||
storyEntries: normalizedStories, | ||
}); | ||
} else { | ||
updateView(global.view, annotations, normalizedStories); | ||
} | ||
|
||
export const view = global.view; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
// Learn more https://docs.expo.io/guides/customizing-metro | ||
// This replaces `const { getDefaultConfig } = require('expo/metro-config');` | ||
const path = require('path'); | ||
|
||
const { getSentryExpoConfig } = require('@sentry/react-native/metro'); | ||
const withStorybook = require('@storybook/react-native/metro/withStorybook'); | ||
|
||
// This replaces `const config = getDefaultConfig(__dirname);` | ||
const config = getSentryExpoConfig(__dirname); | ||
|
||
module.exports = config; | ||
module.exports = withStorybook(config, { | ||
enabled: process.env.STORYBOOK_ENABLED === 'true', | ||
onDisabledRemoveStorybook: true, | ||
websockets: { | ||
port: 7007, | ||
host: 'localhost', | ||
}, | ||
}); |
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 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.