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

CLI: update sb init to module format for Vue #7501

Merged
merged 4 commits into from
Jul 21, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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/SFC_VUE/template/.storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import { configure } from '@storybook/vue';
import { load } from '@storybook/vue';

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

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

import MyButton from './MyButton.vue';

export default {
title: 'Button',
};

export const text = () => ({
components: { MyButton },
template: '<my-button @click="action">Hello Button</my-button>',
methods: { action: action('clicked') },
});

export const jsx = () => ({
components: { MyButton },
render() {
return <my-button onClick={this.action}>With JSX</my-button>;
},
methods: { action: linkTo('clicked') },
});

export const emoji = () => ({
components: { MyButton },
template:
'<my-button @click="action"><span role="img" aria-label="so cool">😀 😎 👍 💯</span></my-button>',
methods: { action: action('clicked') },
});
17 changes: 17 additions & 0 deletions lib/cli/generators/SFC_VUE/template/src/stories/Welcome.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { linkTo } from '@storybook/addon-links';

import Welcome from './Welcome.vue';

export default {
title: 'Welcome',
};

export const toStorybook = () => ({
components: { Welcome },
template: '<welcome :showApp="action" />',
methods: { action: linkTo('Button') },
});

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

This file was deleted.

9 changes: 2 additions & 7 deletions lib/cli/generators/VUE/template/.storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import { configure } from '@storybook/vue';
import { load } from '@storybook/vue';

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

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

import MyButton from './MyButton';

export default {
title: 'Button',
};

export const text = () => ({
components: { MyButton },
template: '<my-button @click="action">Hello Button</my-button>',
methods: { action: action('clicked') },
});

export const jsx = () => ({
components: { MyButton },
render(h) {
return <my-button onClick={this.action}>With JSX</my-button>;
},
methods: { action: linkTo('clicked') },
});

export const emoji = () => ({
components: { MyButton },
template: '<my-button @click="action">😀 😎 👍 💯</my-button>',
methods: { action: action('clicked') },
});
17 changes: 17 additions & 0 deletions lib/cli/generators/VUE/template/stories/Welcome.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { linkTo } from '@storybook/addon-links';

import Welcome from './Welcome';

export default {
title: 'Welcome',
};

export const toStorybook = () => ({
components: { Welcome },
template: '<welcome :showApp="action" />',
methods: { action: linkTo('Button') },
});

toStorybook.story = {
name: 'to Storybook',
};
33 changes: 0 additions & 33 deletions lib/cli/generators/VUE/template/stories/index.stories.js

This file was deleted.