Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 2 additions & 7 deletions lib/cli/generators/ANGULAR/template/.storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import { configure } from '@storybook/angular';
import { load } from '@storybook/angular';

// automatically import all files ending in *.stories.ts
const req = require.context('../src/stories', true, /\.stories\.ts$/);
function loadStories() {
req.keys().forEach(filename => req(filename));
}

configure(loadStories, module);
load(require.context('../src/stories', true, /\.stories\.ts$/), module);
51 changes: 51 additions & 0 deletions lib/cli/generators/ANGULAR/template/src/stories/Button.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { action } from '@storybook/addon-actions';
import { linkTo } from '@storybook/addon-links';

import { Button } from '@storybook/angular/demo';

export default {
title: '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',
};
14 changes: 14 additions & 0 deletions lib/cli/generators/ANGULAR/template/src/stories/Welcome.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Welcome } from '@storybook/angular/demo';

export default {
title: 'Welcome',
};

export const toStorybook = () => ({
component: Welcome,
props: {},
});

toStorybook.story = {
name: 'to Storybook',
};
47 changes: 0 additions & 47 deletions lib/cli/generators/ANGULAR/template/src/stories/index.stories.ts

This file was deleted.