Skip to content

Instantly share code, notes, and snippets.

@kohlmannj
Created May 29, 2017 14:43
Show Gist options
  • Save kohlmannj/3de1e5852bdde607724bee2e55358a5b to your computer and use it in GitHub Desktop.
Save kohlmannj/3de1e5852bdde607724bee2e55358a5b to your computer and use it in GitHub Desktop.
import React from 'react';
import { storiesOf } from '@storybook/react';
import withPaidPostArticle from '../../../../../.storybook/withPaidPostArticle';
import withPlacement from '../../../../../.storybook/withPlacement';
import Figure from '../Figure';
import { paragraphs as lipsum } from '../../../../utils/placeholders/lorem-ipsum.json';
import breakpoints from '../../../../utils/layout/breakpoints.json';
const srcObj = {
[breakpoints.compact]: 'http://placehold.it/480x480',
[breakpoints.regular]: 'http://placehold.it/1152x1152',
};
const testProps = {
title: 'Test Title',
subtitle: 'Test Subtitle',
caption: 'This is a caption for a figure.',
credit: 'Larry Ipsum',
src: srcObj,
};
storiesOf('Figure', module)
.addDecorator(withPlacement())
.addDecorator(withPaidPostArticle())
.add('with all props (story)', () => (
<Figure
src={testProps.src}
title={<span>An <em>Expressive</em> Figure Title</span>}
subtitle="Introduce the Figure or Offer a Call to Action"
caption={`${lipsum[3].substr(0, 180)}.`}
credit="Larry Ipsum"
center
circle
/>
))
.add('with a Picture (story)', () => (
<Figure src={testProps.src} title={<span>An <em>Expressive</em> Figure Title</span>} />
));
@kohlmannj
Copy link
Author

kohlmannj commented May 29, 2017

withPaidPostArticle and withPlacement each wrap the component in wrapper components. Each decorator also uses @storybook/addon-knobs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment