diff --git a/lib/cli/generators/HTML/template/.storybook/config.js b/lib/cli/generators/HTML/template/.storybook/config.js index 1eeb929da67..05624b74e9a 100644 --- a/lib/cli/generators/HTML/template/.storybook/config.js +++ b/lib/cli/generators/HTML/template/.storybook/config.js @@ -1,9 +1,4 @@ -import { configure } from '@storybook/html'; +import { load } from '@storybook/html'; // 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); diff --git a/lib/cli/generators/HTML/template/stories/index.stories.js b/lib/cli/generators/HTML/template/stories/index.stories.js index f8fcbf948ad..bba6998ee7b 100644 --- a/lib/cli/generators/HTML/template/stories/index.stories.js +++ b/lib/cli/generators/HTML/template/stories/index.stories.js @@ -1,12 +1,15 @@ import { document, console } from 'global'; -import { storiesOf } from '@storybook/html'; -storiesOf('Demo', module) - .add('heading', () => '

Hello World

') - .add('button', () => { - const button = document.createElement('button'); - button.type = 'button'; - button.innerText = 'Hello Button'; - button.addEventListener('click', e => console.log(e)); - return button; - }); +export default { + title: 'Demo', +}; + +export const heading = () => '

Hello World

'; + +export const button = () => { + const btn = document.createElement('button'); + btn.type = 'button'; + btn.innerText = 'Hello Button'; + btn.addEventListener('click', e => console.log(e)); + return btn; +};