Permalink
Browse files

Add (P)react Storybook. (#142)

  • Loading branch information...
nickytonline authored and maestromac committed Mar 26, 2018
1 parent 447a134 commit 6a8df8c8ddec739280325c0000d6d32593f70ed0
@@ -37,3 +37,6 @@ latest.dump
/public/packs
/public/packs-test
/node_modules
# Ignore storybook static site generation
storybook-static/
@@ -0,0 +1,2 @@
import '@storybook/addon-actions/register';
import '@storybook/addon-links/register';
@@ -0,0 +1,9 @@
import { configure } from '@storybook/react';
// 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);
@@ -0,0 +1,9 @@
module.exports = {
resolve: {
extensions: [".js", "jsx"],
alias: {
react: "preact-compat",
"react-dom": "preact-compat"
}
}
};
@@ -0,0 +1,13 @@
import { h } from "preact";
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { linkTo } from '@storybook/addon-links';
import { Button, Welcome } from '@storybook/react/demo';
storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);
storiesOf('Button', module)
.add('with text', () => <Button onClick={action('clicked')}>Hello Button</Button>)
.add('with some emoji', () => <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>);
Oops, something went wrong.

0 comments on commit 6a8df8c

Please sign in to comment.