From 0266c97dc5588f323562ed09f98fafc23b294eb8 Mon Sep 17 00:00:00 2001 From: Jaco Bovenschen Date: Tue, 4 Oct 2016 23:10:43 +0200 Subject: [PATCH] Create more example stories (#1) * Add Button example * Add semicolon behind import * Add Image example * Add Form examples * Add Typography examples --- .../.storybook/components/Button/component.js | 46 +++++++++++++++++++ .../.storybook/components/Button/stories.js | 34 ++++++++++++++ .../components/Form/components/Input.js | 21 +++++++++ .../components/Form/components/Label.js | 25 ++++++++++ .../components/Form/components/Row.js | 20 ++++++++ .../components/Form/components/index.js | 9 ++++ .../.storybook/components/Form/stories.js | 36 +++++++++++++++ .../.storybook/components/Image/component.js | 19 ++++++++ .../.storybook/components/Image/stories.js | 29 ++++++++++++ .../Typography/components/Heading.js | 23 ++++++++++ .../components/Typography/components/Link.js | 16 +++++++ .../components/Typography/components/Text.js | 15 ++++++ .../components/Typography/components/index.js | 9 ++++ .../components/Typography/stories.js | 41 +++++++++++++++++ addons/a11y/.storybook/config.js | 9 +++- addons/a11y/.storybook/stories.js | 24 ---------- addons/a11y/package.json | 1 + 17 files changed, 352 insertions(+), 25 deletions(-) create mode 100644 addons/a11y/.storybook/components/Button/component.js create mode 100644 addons/a11y/.storybook/components/Button/stories.js create mode 100644 addons/a11y/.storybook/components/Form/components/Input.js create mode 100644 addons/a11y/.storybook/components/Form/components/Label.js create mode 100644 addons/a11y/.storybook/components/Form/components/Row.js create mode 100644 addons/a11y/.storybook/components/Form/components/index.js create mode 100644 addons/a11y/.storybook/components/Form/stories.js create mode 100644 addons/a11y/.storybook/components/Image/component.js create mode 100644 addons/a11y/.storybook/components/Image/stories.js create mode 100644 addons/a11y/.storybook/components/Typography/components/Heading.js create mode 100644 addons/a11y/.storybook/components/Typography/components/Link.js create mode 100644 addons/a11y/.storybook/components/Typography/components/Text.js create mode 100644 addons/a11y/.storybook/components/Typography/components/index.js create mode 100644 addons/a11y/.storybook/components/Typography/stories.js delete mode 100755 addons/a11y/.storybook/stories.js diff --git a/addons/a11y/.storybook/components/Button/component.js b/addons/a11y/.storybook/components/Button/component.js new file mode 100644 index 000000000000..6feb58e1a634 --- /dev/null +++ b/addons/a11y/.storybook/components/Button/component.js @@ -0,0 +1,46 @@ +import React, { PropTypes } from 'react'; + +const styles = { + button: { + padding: '12px 6px', + fontSize: '12px', + lineHeight: '16px', + borderRadius: '5px', + }, + ok: { + backgroundColor: '#028402', + color: '#ffffff', + }, + wrong: { + color: '#ffffff', + backgroundColor: '#4caf50', + } +} + +function Button({ label, content, disabled, contrast }) { + return ( + + ) +} + +Button.propTypes = { + label: PropTypes.string, + content: PropTypes.string, + disabled: PropTypes.bool, + contrast: PropTypes.oneOf(['ok', 'wrong']) +}; + +Button.defaultProps = { + disabled: false, + contrast: 'ok', +}; + +export default Button; diff --git a/addons/a11y/.storybook/components/Button/stories.js b/addons/a11y/.storybook/components/Button/stories.js new file mode 100644 index 000000000000..a005a2c95d7b --- /dev/null +++ b/addons/a11y/.storybook/components/Button/stories.js @@ -0,0 +1,34 @@ +import React from 'react'; +import { storiesOf } from '@kadira/storybook'; + +import { checkA11y } from './../../../src'; + +import Button from './component'; + +import Faker from 'faker'; + +const text = Faker.lorem.words(); + +storiesOf(' - )) - .add('Red button', () => ( -
- - - -
- )); diff --git a/addons/a11y/package.json b/addons/a11y/package.json index d4983438b1a7..f88b6ab432bd 100644 --- a/addons/a11y/package.json +++ b/addons/a11y/package.json @@ -26,6 +26,7 @@ "babel-jest": "^15.0.0", "babel-polyfill": "^6.13.0", "babel-preset-react-app": "^0.2.1", + "faker": "^3.1.0", "jest": "^15.1.1", "lodash": "^4.16.2", "react": "^15.3.1",