Skip to content

Commit

Permalink
Merge pull request #9 from 4so-fourseasons/minor-story-changes
Browse files Browse the repository at this point in the history
Change README display and add root README to stories
  • Loading branch information
on3iro committed Jan 26, 2018
2 parents f23d75e + 2428c55 commit d34b8e0
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 85 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[![Build Status](https://travis-ci.org/4so-fourseasons/react-hoc-spinners.svg?branch=master)](https://travis-ci.org/4so-fourseasons/react-hoc-spinners)
[![Coverage Status](https://coveralls.io/repos/github/4so-fourseasons/react-hoc-spinners/badge.svg?branch=master)](https://coveralls.io/github/4so-fourseasons/react-hoc-spinners?branch=master)
[![npm version](https://badge.fury.io/js/%404so-fourseasons%2Freact-hoc-spinners.svg)](https://badge.fury.io/js/%404so-fourseasons%2Freact-hoc-spinners)
[![api docs](https://img.shields.io/badge/docs-API-C8022F.svg)](https://4so-fourseasons.github.io/react-hoc-spinners/)
[![Maintainability](https://api.codeclimate.com/v1/badges/a7675da10113147e80e7/maintainability)](https://codeclimate.com/github/4so-fourseasons/react-hoc-spinners/maintainability)
[![JavavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![style: styled-components](https://img.shields.io/badge/style-%F0%9F%92%85%20styled--components-orange.svg?colorB=daa357&colorA=db748e)](https://github.com/styled-components/styled-components)

[![Github](https://img.shields.io/badge/GitHub-4so--fourseasons%2Freact--hoc--spinners-blue.svg?style=flat-square)](https://github.com/4so-fourseasons/react-hoc-spinners)
[![api docs](https://img.shields.io/badge/docs-API-C8022F.svg?style=flat-square)](https://4so-fourseasons.github.io/react-hoc-spinners/)


# react-hoc-spinners

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"ignore": [
"**/dist/",
"**/flow-typed",
"**/docs"
"**/docs",
"**/*.stories.{js,jsx}"
],
"globals": [
"jest",
Expand Down
115 changes: 52 additions & 63 deletions src/HOCS/stories.jsx
Original file line number Diff line number Diff line change
@@ -1,81 +1,70 @@
import React from 'react'
import { storiesOf } from '@storybook/react'
import { withDocs } from 'storybook-readme'
import { withDocs, withReadme } from 'storybook-readme'

import README from './makeWithLoadingIndicator.README.md'
import README from '../../README.md'

import ComponentREADME from './makeWithLoadingIndicator.README.md'
import { makeWithLoadingIndicator } from './makeWithLoadingIndicator.jsx'

const WrappedComponent = (props) => (
<h1>Wrapped Component</h1>
)

storiesOf('HOCS/makeWithLoadingIndicator', module)
.add('Condition is false -> display wrapped Component', withDocs(
README,
() => {
const WithLoadingIndicator = makeWithLoadingIndicator({
condition: () => false
})(WrappedComponent)
.addDecorator(withDocs(ComponentREADME))
.addDecorator(withReadme(README))
.add('Condition is false -> display wrapped Component', () => {
const WithLoadingIndicator = makeWithLoadingIndicator({
condition: () => false
})(WrappedComponent)

return (
<WithLoadingIndicator />
)
})
return (
<WithLoadingIndicator />
)
.add('Condition is true -> display loading indicator', withDocs(
README,
() => {
const WithLoadingIndicator = makeWithLoadingIndicator({
condition: () => true
})(WrappedComponent)
})
.add('Condition is true -> display loading indicator', () => {
const WithLoadingIndicator = makeWithLoadingIndicator({
condition: () => true
})(WrappedComponent)

return (
<WithLoadingIndicator />
)
})
)
.add('Overwrite spinnerConfig', withDocs(
README,
() => {
const WithLoadingIndicator = makeWithLoadingIndicator({
condition: () => true,
spinnerConfig: {
highlightColor: 'green'
}
})(WrappedComponent)
return (
<WithLoadingIndicator />
)
})
.add('Overwrite spinnerConfig', () => {
const WithLoadingIndicator = makeWithLoadingIndicator({
condition: () => true,
spinnerConfig: {
highlightColor: 'green'
}
})(WrappedComponent)

return (
<WithLoadingIndicator />
)
})
)
.add('Specify spinner', withDocs(
README,
() => {
const WithLoadingIndicator = makeWithLoadingIndicator({
condition: () => true,
spinnerType: 'Cube'
})(WrappedComponent)
return (
<WithLoadingIndicator />
)
})
.add('Specify spinner', () => {
const WithLoadingIndicator = makeWithLoadingIndicator({
condition: () => true,
spinnerType: 'Cube'
})(WrappedComponent)

return (
<WithLoadingIndicator />
)
})
)
.add('Specify custom component as spinner', withDocs(
README,
() => {
const CustomComponent = (props) => (
<h1>Custom Component</h1>
return (
<WithLoadingIndicator />
)
})
.add('Specify custom component as spinner', () => {
const CustomComponent = (props) => (
<h1>Custom Component</h1>
)

const WithLoadingIndicator = makeWithLoadingIndicator({
condition: () => true,
spinnerType: CustomComponent
})(WrappedComponent)
const WithLoadingIndicator = makeWithLoadingIndicator({
condition: () => true,
spinnerType: CustomComponent
})(WrappedComponent)

return (
<WithLoadingIndicator />
)
})
)
return (
<WithLoadingIndicator />
)
})
25 changes: 13 additions & 12 deletions src/components/Cube/stories.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import React from 'react'
import { storiesOf } from '@storybook/react'
import { withDocs } from 'storybook-readme'
import { withDocs, withReadme } from 'storybook-readme'

import README from './README.md'
import README from '../../../README.md'

import ComponentREADME from './README.md'
import Cube from './index.jsx'

storiesOf('components/Cube', module)
.add('Default', withDocs(
README,
() => (
<Cube
size={40}
dark='#333333'
light='#c8022f'
/>
))
)
.addDecorator(withDocs(ComponentREADME))
.addDecorator(withReadme(README))
.add('Default', () => (
<Cube
size={40}
dark='#333333'
light='#c8022f'
/>
))
17 changes: 9 additions & 8 deletions src/components/SimpleCircle/stories.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React from 'react'
import { storiesOf } from '@storybook/react'
import { withDocs } from 'storybook-readme'
import { withDocs, withReadme } from 'storybook-readme'

import README from './README.md'
import README from '../../../README.md'

import ComponentREADME from './README.md'
import SimpleCircle from './index.jsx'

storiesOf('components/SimpleCircle', module)
.add('Default', withDocs(
README,
() => (
<SimpleCircle />
))
)
.addDecorator(withDocs(ComponentREADME))
.addDecorator(withReadme(README))
.add('Default', () => (
<SimpleCircle />
))

0 comments on commit d34b8e0

Please sign in to comment.