diff --git a/src/ui/async/AsyncContainer.stories.js b/src/ui/async/AsyncContainer.stories.js new file mode 100644 index 0000000..80aec68 --- /dev/null +++ b/src/ui/async/AsyncContainer.stories.js @@ -0,0 +1,23 @@ +import React from 'react'; +import styled from 'styled-components'; + +import { storiesOf } from '@storybook/react'; + +import AsyncContainer from './AsyncContainer'; +import { Colors } from '../../styles'; + +import { baseName, sharedKnobs } from './async.stories'; + +const Styles = { + Background: styled.div` + background-color: ${Colors.ColorsPalette.White}; + padding: 3rem; + `, +}; + +storiesOf(`${baseName}/AsyncContainer`) + .add('default', () => ( + +

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

+
+
)); diff --git a/src/ui/async/AsyncImage.jsx b/src/ui/async/AsyncImage.jsx index 80d77c5..e044472 100644 --- a/src/ui/async/AsyncImage.jsx +++ b/src/ui/async/AsyncImage.jsx @@ -11,7 +11,7 @@ export const StyledAsyncImage = styled(Box)` transition: all 0.5s ease; img { opacity: ${props => props.loaded ? '1' : '0'}; - display: ${props => props.loaded || props.neverHideImg ? 'flex' : 'none'}; + display: ${props => (props.loaded || props.neverHideImg) ? 'flex' : 'none'}; } `; diff --git a/src/ui/async/AsyncImage.stories.js b/src/ui/async/AsyncImage.stories.js new file mode 100644 index 0000000..e3dc884 --- /dev/null +++ b/src/ui/async/AsyncImage.stories.js @@ -0,0 +1,24 @@ +import React from 'react'; + +import { storiesOf } from '@storybook/react'; +import { boolean } from '@storybook/addon-knobs'; +import { action } from '@storybook/addon-actions'; + +import AsyncImage from './AsyncImage'; + +import { baseName, sharedKnobs } from './async.stories'; + +storiesOf(`${baseName}/AsyncImage`) + .add('default', () => ( + + )) + .add('with never hide img enabled', () => ( + + )); diff --git a/src/ui/async/LoadingIndicator.stories.js b/src/ui/async/LoadingIndicator.stories.js new file mode 100644 index 0000000..08a397a --- /dev/null +++ b/src/ui/async/LoadingIndicator.stories.js @@ -0,0 +1,21 @@ +import React from 'react'; + +import { storiesOf } from '@storybook/react'; +import { color } from '@storybook/addon-knobs'; + +import LoadingIndicator from './LoadingIndicator'; +import { Colors } from '../../styles'; + +import { baseName, sharedKnobs } from './async.stories'; + +storiesOf(`${baseName}/LoadingIndicator`, module) + .add('default', () => ( + + )); diff --git a/src/ui/async/async.stories.js b/src/ui/async/async.stories.js new file mode 100644 index 0000000..33c40e4 --- /dev/null +++ b/src/ui/async/async.stories.js @@ -0,0 +1,9 @@ +import { boolean, files, number } from '@storybook/addon-knobs'; + +export const baseName = 'Async'; + +export const sharedKnobs = { + getLoading: () => boolean('Loading', true), + getImage: () => files('Src (image)', 'image/*', []), + getSize: () => number('Size', 100), +};