Skip to content

Commit

Permalink
chore: update to storybook v6
Browse files Browse the repository at this point in the history
  • Loading branch information
SiTaggart committed Jan 25, 2021
1 parent 1bc0796 commit 79294f0
Show file tree
Hide file tree
Showing 95 changed files with 2,914 additions and 1,475 deletions.
35 changes: 35 additions & 0 deletions .storybook/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"ie": "11",
"edge": "17",
"firefox": "60",
"chrome": "67",
"safari": "11.1"
}
}
],
"@babel/preset-react",
"@babel/preset-typescript",
[
"@emotion/babel-preset-css-prop",
{
"sourceMap": "true",
"autoLabel": "true",
"labelFormat": "[local]",
"cssPropOptimization": "false"
}
]
],
"plugins": [
"macros",
["@babel/proposal-class-properties", {"loose": true}],
"@babel/proposal-object-rest-spread",
["@babel/proposal-private-methods", {"loose": true}],
["@babel/proposal-private-property-in-object", {"loose": true}],
"@babel/plugin-transform-runtime"
]
}
7 changes: 0 additions & 7 deletions .storybook/addons.js

This file was deleted.

7 changes: 0 additions & 7 deletions .storybook/addons/theme-switcher-addon/constants.js

This file was deleted.

44 changes: 0 additions & 44 deletions .storybook/addons/theme-switcher-addon/index.js

This file was deleted.

72 changes: 0 additions & 72 deletions .storybook/addons/theme-switcher-addon/register.js

This file was deleted.

30 changes: 0 additions & 30 deletions .storybook/babel.config.js

This file was deleted.

23 changes: 0 additions & 23 deletions .storybook/config.js

This file was deleted.

27 changes: 27 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
stories: ['../packages/**/*.stories.mdx', '../packages/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-a11y',
'@storybook/addon-knobs',
'@storybook/addon-actions',
'@storybook/addon-viewport',
'storybook-addon-performance',
],
typescript: {
// enable type checking
check: true,
checkOptions: {
// check all ts and tsx files, but not fixtures as they include errors on purpose
reportFiles: ['packages/**/*.{ts,tsx}', '!**/__testfixtures__/**/*', '!**/__fixtures__/**/*'],
},
// choose react-docgen-typescript to generate the prop tables
reactDocgen: 'react-docgen-typescript',
reactDocgenTypescriptOptions: {
shouldExtractLiteralValuesFromEnum: true,
// don't include node_module props as you'll cause the machine to run out of memory on our repo
propFilter: (prop) => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true),
},
},
};
24 changes: 24 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,30 @@
font-weight: 700;
font-style: normal;
}

/**
* Colfax font family
*/
@font-face {
font-family: Colfax;
font-style: normal;
font-weight: 300;
src: url(/fonts/colfax-light.woff2) format('woff2'), url(/fonts/colfax-light.woff) format('woff');
}

@font-face {
font-family: Colfax;
font-style: normal;
font-weight: 400;
src: url(/fonts/colfax-regular.woff2) format('woff2'), url(/fonts/colfax-regular.woff) format('woff');
}

@font-face {
font-family: Colfax;
font-style: normal;
font-weight: 600;
src: url(/fonts/colfax-medium.woff2) format('woff2'), url(/fonts/colfax-medium.woff) format('woff');
}
</style>

<link rel="preconnect" href="https://assets.twilio.com" crossorigin />
Expand Down
41 changes: 41 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';
import {INITIAL_VIEWPORTS} from '@storybook/addon-viewport';
import {withPerformance} from 'storybook-addon-performance';
import {Theme} from '@twilio-paste/theme';
import {Box} from '@twilio-paste/box';

export const globalTypes = {
theme: {
name: 'Paste Theme',
description: 'Global theme for components',
defaultValue: 'default',
toolbar: {
// All available icons
// https://github.com/storybookjs/storybook/blob/master/lib/components/src/icon/icons.tsx
icon: 'paintbrush',
// array of plain string values or MenuItem shape (see below)
items: ['sendgrid', 'console', 'default'],
},
},
};

export const decorators = [
(Story, context) => {
const theme = context.globals.theme;
return (
<Theme.Provider theme={theme}>
<Box padding="space40">
<Story />
</Box>
</Theme.Provider>
);
},
withPerformance,
];

export const parameters = {
actions: {argTypesRegex: '^on[A-Z].*'},
viewport: {
viewports: INITIAL_VIEWPORTS,
},
};
37 changes: 0 additions & 37 deletions .storybook/webpack.config.js

This file was deleted.

1 change: 1 addition & 0 deletions @types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ declare module '*.md' {
const value: string;
export default value;
}
declare module '*.png'
4 changes: 3 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const getPresets = isDev => [
const getPresets = (isDev) => [
[
'@babel/preset-env',
{
Expand Down Expand Up @@ -29,6 +29,8 @@ const BASE_PLUGINS = [
'macros',
'@babel/proposal-class-properties',
'@babel/proposal-object-rest-spread',
'@babel/proposal-private-methods',
'@babel/proposal-private-property-in-object',
'@babel/plugin-transform-runtime',
];

Expand Down
Loading

0 comments on commit 79294f0

Please sign in to comment.