-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7501 from storybookjs/7499-module-format-vue
CLI: update `sb init` to module format for Vue
- Loading branch information
Showing
11 changed files
with
97 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
29
lib/cli/generators/SFC_VUE/template/src/stories/Button.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
17
lib/cli/generators/SFC_VUE/template/src/stories/Welcome.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
34
lib/cli/generators/SFC_VUE/template/src/stories/index.stories.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
17
lib/cli/generators/VUE/template/stories/Welcome.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}; |
This file was deleted.
Oops, something went wrong.
f712df8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully aliased the URL https://monorepo-93ft0mlwv.now.sh to the following aliases: