ad storybook

This commit is contained in:
Baptiste Lemoine 2020-02-18 13:52:22 +01:00
parent 61bf6a289c
commit 4ec9b174ad
8 changed files with 6039 additions and 669 deletions

4
.storybook/main.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
stories: ['../src/**/*.stories.ts'],
addons: ['@storybook/addon-actions', '@storybook/addon-links', '@storybook/addon-notes'],
};

20
.storybook/tsconfig.json Normal file
View File

@ -0,0 +1,20 @@
{
"extends": "../tsconfig.app.json",
"compilerOptions": {
"types": [
"node"
]
},
"exclude": [
"../src/test.ts",
"../src/**/*.spec.ts",
"../projects/**/*.spec.ts"
],
"include": [
"../src/**/*",
"../projects/**/*"
],
"files": [
"./typings.d.ts"
]
}

4
.storybook/typings.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
declare module '*.md' {
const content: string;
export default content;
}

View File

@ -13,7 +13,9 @@
"test": "ng test --code-coverage --single-run",
"lint": "ng lint",
"e2e": "ng e2e",
"trans": "ng xi18n --output-path=src/locale --i18n-locale=fr"
"trans": "ng xi18n --output-path=src/locale --i18n-locale=fr",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"private": false,
"dependencies": {
@ -53,9 +55,16 @@
"@angular/cli": "~9.0.1",
"@angular/compiler-cli": "^9.0.0",
"@angular/language-service": "~9.0.0",
"@babel/core": "^7.8.4",
"@storybook/addon-actions": "^5.3.13",
"@storybook/addon-links": "^5.3.13",
"@storybook/addon-notes": "^5.3.13",
"@storybook/addons": "^5.3.13",
"@storybook/angular": "^5.3.13",
"@types/jasmine": "~3.5.3",
"@types/jasminewd2": "~2.0.8",
"@types/node": "^12.11.1",
"babel-loader": "^8.0.6",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",

View File

@ -0,0 +1,15 @@
import { Welcome } from '@storybook/angular/demo';
export default {
title: 'Welcome',
component: Welcome,
};
export const ToStorybook = () => ({
component: Welcome,
props: {},
});
ToStorybook.story = {
name: 'to Storybook',
};

View File

@ -0,0 +1,52 @@
import { action } from '@storybook/addon-actions';
import { linkTo } from '@storybook/addon-links';
import { Button } from '@storybook/angular/demo';
export default {
title: 'Button',
component: Button,
};
export const Text = () => ({
component: Button,
props: {
text: 'Hello Button',
},
});
export const Emoji = () => ({
component: Button,
props: {
text: '😀 😎 👍 💯',
},
});
Emoji.story = {
parameters: { notes: 'My notes on a button with emojis' },
};
export const WithSomeEmojiAndAction = () => ({
component: Button,
props: {
text: '😀 😎 👍 💯',
onClick: action('This was clicked OMG'),
},
});
WithSomeEmojiAndAction.story = {
name: 'with some emoji and action',
parameters: { notes: 'My notes on a button with emojis' },
};
export const ButtonWithLinkToAnotherStory = () => ({
component: Button,
props: {
text: 'Go to Welcome Story',
onClick: linkTo('Welcome'),
},
});
ButtonWithLinkToAnotherStory.story = {
name: 'button with link to another story',
};

View File

@ -1,23 +1,24 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": [
"node"
],
"typeRoots": [
"./node_modules/@types"
]
},
"files": [
"src/main.ts",
"src/polyfills.ts"
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": [
"node"
],
"include": [
"src/**/*.d.ts"
],
"exclude": [
"src/test.ts",
"src/**/*.spec.ts"
"typeRoots": [
"./node_modules/@types"
]
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
],
"exclude": [
"src/test.ts",
"src/**/*.spec.ts",
"**/*.stories.ts"
]
}

6563
yarn.lock

File diff suppressed because it is too large Load Diff