Skip to content
This repository has been archived by the owner on Jul 4, 2018. It is now read-only.

Commit

Permalink
Adding default Storybook config to the project
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Hoogeveen committed Feb 22, 2017
1 parent e06ac01 commit f2888dc
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -25,6 +25,7 @@ node_modules

# build directory
build
.out

# Optional npm cache directory
.npm
Expand Down
7 changes: 7 additions & 0 deletions .storybook/config.js
@@ -0,0 +1,7 @@
import { configure } from '@kadira/storybook';

function loadStories() {
require('../stories');
}

configure(loadStories, module);
19 changes: 19 additions & 0 deletions .storybook/webpack.config.js
@@ -0,0 +1,19 @@
/**
* This webpack config is only used by storybook
* We modified it a little bit to mimick the way we load
* CSS/Scss files in the main project
*/

const path = require('path');

module.exports = {
module: {
loaders: [
{
test: /.scss$/,
loaders: ['style', 'css?modules=1', 'sass'],
include: path.resolve(__dirname, '../'),
},
],
},
};
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -29,6 +29,7 @@ The following are some of the tools included in this starter-kyt:
The libraries listed here are not present by default in the NYT React Universal Starter Kyt. We added them because we believe they are useful to the majority of the applications we develop.

- [Redux and Redux DevTools](https://github.com/reactjs/redux) - State management. Press CTRL-H to see the DevTools Monitor.
- [Storybook](https://getstorybook.io/) - Isolated component development and component library
- [Redux-Thunks](https://github.com/gaearon/redux-thunk) - Thunk middleware for React Redux
- [Helmet](https://github.com/nfl/react-helmet) - This reusable React component will manage all of your changes to the document head with support for document title, meta, link, style, script, noscript, and base tags.
- [React SVG loader](https://github.com/boopathi/react-svg-loader) - Used to load SVG files with Webpack and use them as React Components. This inlines the SVG and allows us to style it with CSS and keep our code clean and 'dry'.
Expand Down
11 changes: 7 additions & 4 deletions package.json
@@ -1,10 +1,12 @@
{
"name": "cf-kyt-starter-universal-redux",
"version": "1.2.1",
"version": "1.3.0",
"description": "A starter kyt with React, Redux, SSR and data fetching.",
"main": "index.js",
"scripts": {
"build": "kyt build --config kyt.config.production.js && sw-precache --config=sw-precache-config.js",
"storybook": "start-storybook -p 6006 --dont-track",
"build-storybook": "build-storybook"
},
"repository": {
"type": "git",
Expand All @@ -18,8 +20,8 @@
"homepage": "https://github.com/cleverfranke/cf-kyt-starter-universal-redux#readme",
"kyt": {
"version": "^0.4.0",
"files": [".eslintrc.json", "sw-precache-config.js"],
"scripts": ["build"]
"files": [".eslintrc.json", "sw-precache-config.js", ".storybook", "stories"],
"scripts": ["build", "storybook", "build-storybook"]
},
"dependencies": {
"classnames": "^2.2.5",
Expand Down Expand Up @@ -48,6 +50,7 @@
"redux-devtools-log-monitor": "^1.1.1",
"redux-devtools": "^3.3.1",
"sw-precache": "^4.3.0",
"webpack-merge": "^2.6.1"
"webpack-merge": "^2.6.1",
"@kadira/storybook": "^2.21.0"
}
}
46 changes: 46 additions & 0 deletions stories/index.js
@@ -0,0 +1,46 @@
import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import { Count } from '../src/components/Count';
import '../src/containers/App/styles.scss';

storiesOf('Count', module)
.add('Empty', () => (
<Count
shouldIncrement={action('increment it')}
promiseIncrement={action('promise increment it')}
count={0}
promiseCount={0}
rejectionCount={0}
promisePending={false}
/>
))
.add('Promise pending', () => (
<Count
shouldIncrement={action('increment it')}
promiseIncrement={action('promise increment it')}
count={0}
promiseCount={0}
rejectionCount={0}
promisePending
/>
))
.add('Count 1', () => (
<Count
shouldIncrement={action('increment it')}
promiseIncrement={action('promise increment it')}
count={1}
promiseCount={0}
rejectionCount={0}
promisePending={false}
/>
))
.add('Promise count 1', () => (
<Count
shouldIncrement={action('increment it')}
promiseIncrement={action('promise increment it')}
count={0}
promiseCount={1}
rejectionCount={0}
promisePending={false}
/>
));

0 comments on commit f2888dc

Please sign in to comment.