Skip to content

Commit

Permalink
Setup storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinschopf committed Mar 7, 2021
1 parent 7f39803 commit 2cd8f1c
Show file tree
Hide file tree
Showing 5 changed files with 7,457 additions and 83 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,6 @@ $RECYCLE.BIN/
*.msp

# Windows shortcuts
*.lnk
*.lnk

storybook-static/
25 changes: 25 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const path = require("path");

module.exports = {
stories: ["../src/*.stories.tsx"],
// Add any Storybook addons you want here: https://storybook.js.org/addons/
addons: [],
webpackFinal: async (config) => {
config.module.rules.push({
test: /\.scss$/,
use: ["style-loader", "css-loader", "sass-loader"],
include: path.resolve(__dirname, "../"),
});

config.module.rules.push({
test: /\.(ts|tsx)$/,
loader: require.resolve("babel-loader"),
options: {
presets: [["react-app", { flow: false, typescript: true }]],
},
});
config.resolve.extensions.push(".ts", ".tsx");

return config;
},
};
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
"devDependencies": {
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"@storybook/react": "^6.1.21",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.1",
"babel-loader": "^8.2.2",
"babel-preset-react-app": "^10.0.0",
"postcss": "^8.2.7",
"prettier": "^2.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
Expand All @@ -31,8 +35,10 @@
"typescript": "^4.2.3"
},
"scripts": {
"style:fix": "prettier --write src/ *.js *.ts *.json .github/",
"style:lint": "prettier --check src/ *.js *.ts *.json .github/",
"style:fix": "prettier --write src/ *.js *.ts *.json .github/ .storybook/",
"style:lint": "prettier --check src/ *.js *.ts *.json .github/ .storybook/",
"storybook:start": "start-storybook -p 6006",
"storybook:build": "build-storybook",
"build": "rollup --config"
},
"prettier": {
Expand Down
16 changes: 8 additions & 8 deletions build/index.d.ts → src/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
* @copyright 2021 Marvin Schopf
*
*/
import * as React from "react";
declare type Props = {
value?: string;

import React from "react";
import Hours from "./index";

export default {
title: "Hours",
};
declare class Hours extends React.Component<Props> {
constructor(props: Props);
render(): any;
}
export default Hours;

export const Primary = () => <Hours />;
Loading

0 comments on commit 2cd8f1c

Please sign in to comment.