Skip to content

Commit

Permalink
feat(example): add Storybook for example app
Browse files Browse the repository at this point in the history
Add storybook and stories for example app

Resolves #71

Signed-off-by: Niloy Sikdar <niloysikdar30@gmail.com>
  • Loading branch information
niloysikdar committed Aug 6, 2022
1 parent aae13a6 commit b6aedef
Show file tree
Hide file tree
Showing 7 changed files with 9,865 additions and 3 deletions.
9 changes: 9 additions & 0 deletions example/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// .babelrc

{
"presets": [
"@babel/preset-env",
"@babel/preset-typescript",
["@babel/preset-react", { "runtime": "automatic" }]
]
}
9 changes: 9 additions & 0 deletions example/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
framework: '@storybook/react',
};
9 changes: 9 additions & 0 deletions example/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
};
19 changes: 18 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,29 @@
"prepare": "yarn build",
"build": "rm -rf lib && yarn build:esm && yarn build:cjs",
"build:esm": "tsc -p tsconfig.json",
"build:cjs": "tsc -p tsconfig.json --module commonjs --outDir lib/cjs --target es2015"
"build:cjs": "tsc -p tsconfig.json --module commonjs --outDir lib/cjs --target es2015",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook -o docs-build"
},
"dependencies": {
"@leopardslab/react-email": "file:leopardslab-react-email-1.7.0.tgz"
},
"devDependencies": {
"@babel/core": "^7.18.10",
"@babel/preset-env": "^7.18.10",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@storybook/addon-actions": "^6.5.10",
"@storybook/addon-essentials": "^6.5.10",
"@storybook/addon-interactions": "^6.5.10",
"@storybook/addon-links": "^6.5.10",
"@storybook/builder-webpack4": "^6.5.10",
"@storybook/manager-webpack4": "^6.5.10",
"@storybook/react": "^6.5.10",
"@storybook/testing-library": "^0.0.13",
"babel-loader": "^8.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^4.7.4"
}
}
13 changes: 13 additions & 0 deletions example/src/Layouts/HelloEmail.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { ComponentStory, ComponentMeta } from '@storybook/react';

import { HelloEmail } from './HelloEmail';

export default {
component: HelloEmail,
} as ComponentMeta<typeof HelloEmail>;

//“template” of how args map to rendering
const Template: ComponentStory<typeof HelloEmail> = (args) => <HelloEmail {...args} />;

export const Default = Template.bind({});
8 changes: 7 additions & 1 deletion example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,11 @@
"allowSyntheticDefaultImports": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "lib"]
"exclude": [
"node_modules",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.stories.ts",
"**/*.stories.tsx"
]
}
Loading

0 comments on commit b6aedef

Please sign in to comment.