Skip to content
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

WIP: fix Storybook #587

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
setup a single storybook story
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Mar 24, 2022
commit 4b5123aca06024aa67e3ff4bbacc55d94e7fe48a
67 changes: 67 additions & 0 deletions web-app/.babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"shippedProposals": true,
"loose": true
}
],
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-transform-shorthand-properties",
"@babel/plugin-transform-block-scoping",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
],
[
"@babel/plugin-proposal-private-property-in-object",
{
"loose": true
}
],
[
"@babel/plugin-proposal-private-methods",
{
"loose": true
}
],
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-syntax-dynamic-import",
[
"@babel/plugin-proposal-object-rest-spread",
{
"loose": true,
"useBuiltIns": true
}
],
"@babel/plugin-transform-classes",
"@babel/plugin-transform-arrow-functions",
"@babel/plugin-transform-parameters",
"@babel/plugin-transform-destructuring",
"@babel/plugin-transform-spread",
"@babel/plugin-transform-for-of",
"babel-plugin-macros",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
[
"babel-plugin-polyfill-corejs3",
{
"method": "usage-global",
"absoluteImports": "core-js",
"version": "3.21.1"
}
]
]
}
7 changes: 0 additions & 7 deletions web-app/.storybook/.babelrc

This file was deleted.

16 changes: 9 additions & 7 deletions web-app/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -9,11 +9,13 @@ global.acquireVsCodeApi = () => ({
})

module.exports = {
stories: ['../**/*.stories.js'],
addons: [
'@storybook/preset-create-react-app',
'@storybook/addon-actions',
'@storybook/addon-knobs',
'@storybook/addon-links',
],
core: {
builder: 'webpack5',
},
stories: ['../stories/Temp.stories.tsx'],
addons: ['@storybook/addon-actions', '@storybook/addon-knobs', '@storybook/addon-links'],
babel: async (options) => ({
...options,
presets: [...options.presets, '@emotion/babel-preset-css-prop', '@babel/preset-react'],
}),
}
6 changes: 5 additions & 1 deletion web-app/package.json
Original file line number Diff line number Diff line change
@@ -46,10 +46,13 @@
"devDependencies": {
"@babel/core": "7.14.0",
"@babel/helper-environment-visitor": "7.16.7",
"@babel/preset-react": "7.16.7",
"@storybook/addon-actions": "6.4.19",
"@storybook/addon-knobs": "6.4.0",
"@storybook/addon-links": "6.4.19",
"@storybook/addons": "6.4.19",
"@storybook/builder-webpack5": "6.4.19",
"@storybook/manager-webpack5": "6.4.19",
"@storybook/preset-create-react-app": "4.1.0",
"@storybook/react": "6.4.19",
"@types/git-url-parse": "9.0.1",
@@ -73,6 +76,7 @@
"react-scripts": "4.0.3",
"sass-loader": "12.3.0",
"source-map-explorer": "2.5.2",
"typescript": "4.4.4"
"typescript": "4.4.4",
"webpack": "5"
}
}
16 changes: 16 additions & 0 deletions web-app/stories/Temp.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Button.stories.js|jsx

import React from 'react'

const Button = ({ primary, children }) => <button>{children}</button>

export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
}

export const Primary = () => <Button primary>Button</Button>
Loading
Oops, something went wrong.