-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(storybook): add ability to publish storybook to gh-pages
- Loading branch information
Raphaël Benitte
committed
Aug 9, 2017
1 parent
e056aa0
commit b5bfda2
Showing
11 changed files
with
313 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ node_modules | |
/lib | ||
/es | ||
/coverage | ||
/storybook-static |
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,4 +1,4 @@ | ||
/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ | ||
|
||
import '@storybook/addon-actions/register' | ||
import '@storybook/addon-links/register' | ||
import '@storybook/addon-knobs/register' |
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 |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
"recompose": "^0.24.0" | ||
}, | ||
"devDependencies": { | ||
"@storybook/addon-knobs": "^3.2.0", | ||
"@storybook/react": "^3.2.3", | ||
"babel-cli": "^6.24.1", | ||
"babel-jest": "^20.0.3", | ||
|
@@ -57,7 +58,9 @@ | |
"babel-plugin-transform-object-rest-spread": "^6.23.0", | ||
"babel-plugin-transform-react-jsx": "^6.24.1", | ||
"cross-env": "^5.0.2", | ||
"gh-pages": "^1.0.0", | ||
"husky": "^0.14.3", | ||
"import": "^0.0.6", | ||
"jest": "^20.0.4", | ||
"lint-staged": "^4.0.2", | ||
"mocha": "^3.5.0", | ||
|
@@ -90,7 +93,8 @@ | |
"precommit": "lint-staged", | ||
"commitmsg": "validate-commit-msg", | ||
"storybook": "start-storybook -p 6006", | ||
"build-storybook": "build-storybook" | ||
"storybook:build": "build-storybook", | ||
"storybook:publish": "npm run storybook:build && gh-pages -d storybook-static -r [email protected]:plouc/nivo.git -b gh-pages -e storybook" | ||
}, | ||
"lint-staged": { | ||
"*.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
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react' | ||
import { withKnobs, boolean, select } from '@storybook/addon-knobs' | ||
import { generateDrinkStats } from 'nivo-generators' | ||
import '../style.css' | ||
import { Line } from '../../src' | ||
|
||
const commonProperties = { | ||
width: 900, | ||
height: 360, | ||
margin: { top: 60, right: 80, bottom: 60, left: 80 }, | ||
data: generateDrinkStats(18), | ||
animate: true, | ||
} | ||
|
||
const curveOptions = ['linear', 'monotoneX'] | ||
|
||
const stories = storiesOf('Line', module) | ||
|
||
stories | ||
.addDecorator(story => | ||
<div className="wrapper"> | ||
{story()} | ||
</div> | ||
) | ||
.addDecorator(withKnobs) | ||
|
||
stories.add('default', () => | ||
<Line {...commonProperties} curve={select('curve', curveOptions, 'linear')} /> | ||
) | ||
|
||
stories.add('stacked', () => | ||
<Line {...commonProperties} stacked={true} curve={select('curve', curveOptions, 'linear')} /> | ||
) | ||
|
||
stories.add('with custom curve', () => | ||
<Line {...commonProperties} stacked={true} curve="monotoneX" /> | ||
) | ||
|
||
stories.add('with markers label', () => | ||
<Line | ||
{...commonProperties} | ||
stacked={boolean('stacked', true)} | ||
curve={select('curve', curveOptions, 'linear')} | ||
enableMarkersLabel={true} | ||
markersSize={10} | ||
markersBorderColor="#fff" | ||
markersBorderWidth={2} | ||
/> | ||
) | ||
|
||
stories.add('abusing markers label', () => | ||
<Line | ||
{...commonProperties} | ||
stacked={boolean('stacked', true)} | ||
curve={select('curve', curveOptions, 'monotoneX')} | ||
enableMarkersLabel={true} | ||
markersSize={26} | ||
markersLabelYOffset={3} | ||
axisLeft={{ | ||
tickSize: 10, | ||
}} | ||
/> | ||
) | ||
|
||
stories.add('using data colors', () => | ||
<Line | ||
{...commonProperties} | ||
stacked={boolean('stacked', true)} | ||
curve={select('curve', curveOptions, 'linear')} | ||
colorBy={d => d.color} | ||
enableMarkersLabel={true} | ||
markersSize={10} | ||
markersBorderColor="#fff" | ||
markersBorderWidth={2} | ||
/> | ||
) |
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,38 +1,70 @@ | ||
import React from 'react' | ||
|
||
import { storiesOf } from '@storybook/react' | ||
import { withKnobs, select } from '@storybook/addon-knobs' | ||
import { generateSerie, randColor } from 'nivo-generators' | ||
import '../style.css' | ||
import { Radar } from '../../src' | ||
|
||
const commonProperties = { | ||
width: 600, | ||
height: 600, | ||
margin: { top: 60, right: 60, bottom: 60, left: 60 }, | ||
margin: { top: 80, right: 80, bottom: 80, left: 80 }, | ||
facets: ['fruity', 'bitter', 'heavy', 'strong', 'sunny'], | ||
//colors: 'nivo', | ||
data: ['chardonay', 'carmenere', 'syrah'].map(id => ({ | ||
id, | ||
color: randColor(), | ||
data: generateSerie(5), | ||
})), | ||
animate: true, | ||
} | ||
|
||
storiesOf('Radar', module) | ||
const curveOptions = ['linearClosed', 'basisClosed', 'catmullRomClosed', 'cardinalClosed'] | ||
|
||
const stories = storiesOf('Radar', module) | ||
|
||
stories | ||
.addDecorator(story => | ||
<div | ||
style={{ | ||
position: 'absolute', | ||
width: '100%', | ||
height: '100%', | ||
top: 0, | ||
left: 0, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}} | ||
> | ||
<div className="wrapper"> | ||
{story()} | ||
</div> | ||
) | ||
.add('default', () => <Radar {...commonProperties} />) | ||
.add('linear grid shape', () => <Radar {...commonProperties} gridShape="linear" />) | ||
.addDecorator(withKnobs) | ||
|
||
stories.add('default', () => <Radar {...commonProperties} />) | ||
|
||
stories.add('with custom curve', () => | ||
<Radar {...commonProperties} gridShape="linear" curve="catmullRomClosed" /> | ||
) | ||
|
||
stories.add('linear grid shape', () => | ||
<Radar | ||
{...commonProperties} | ||
gridShape="linear" | ||
curve={select('curve', curveOptions, 'linearClosed')} | ||
/> | ||
) | ||
|
||
stories.add('with markers label', () => | ||
<Radar | ||
{...commonProperties} | ||
curve={select('curve', curveOptions, 'linearClosed')} | ||
gridShape="linear" | ||
markersSize={10} | ||
markersBorderColor="#fff" | ||
markersBorderWidth={2} | ||
enableMarkersLabel={true} | ||
gridLabelOffset={36} | ||
/> | ||
) | ||
|
||
stories.add('abusing markers label', () => | ||
<Radar | ||
{...commonProperties} | ||
curve={select('curve', curveOptions, 'catmullRomClosed')} | ||
markersSize={32} | ||
markersLabelYOffset={3} | ||
enableMarkersLabel={true} | ||
gridLabelOffset={36} | ||
/> | ||
) |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
svg text { | ||
font-family: 'Consolas', monospace; | ||
} | ||
|
||
.wrapper { | ||
position: absolute; | ||
width: 100%; | ||
height: 100%; | ||
top: 0; | ||
left: 0; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} |
Oops, something went wrong.