From 95f5b4570e650f10540c85b5e02d63c127185c69 Mon Sep 17 00:00:00 2001 From: Mike Mangialardi Date: Mon, 18 May 2020 17:04:33 -0400 Subject: [PATCH 1/8] Create get short text util --- src/storyUtils.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/storyUtils.js b/src/storyUtils.js index c6f0e5d..bf6075a 100644 --- a/src/storyUtils.js +++ b/src/storyUtils.js @@ -1,3 +1,5 @@ +export const getShortText = () => `lorem ipsum dolor sir amet`; + export const getLongText = () => ` Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Gravida rutrum quisque non tellus. Sagittis vitae et leo duis From a8791875fb0325d6d50d9972c67dd18776f66669 Mon Sep 17 00:00:00 2001 From: Mike Mangialardi Date: Mon, 18 May 2020 17:04:45 -0400 Subject: [PATCH 2/8] Implement choice tile --- src/Choice Tile/index.js | 65 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/Choice Tile/index.js diff --git a/src/Choice Tile/index.js b/src/Choice Tile/index.js new file mode 100644 index 0000000..ee48b4d --- /dev/null +++ b/src/Choice Tile/index.js @@ -0,0 +1,65 @@ +import classNames from 'classnames'; +import PropTypes from 'prop-types'; +import React from 'react'; + +import { SIZES } from '../constants'; +import { wcBool } from '../utils'; + +const ChoiceTile = ({ + checked, + children, + className, + disabled, + icon, + id, + invalid, + onChange, + size, + subdued, + title, + ...rest +}) => { + return ( + + ); +}; + +ChoiceTile.propTypes = { + checked: PropTypes.bool.isRequired, + children: PropTypes.node, + className: PropTypes.string, + disabled: PropTypes.bool, + icon: PropTypes.string, + id: PropTypes.string.isRequired, + invalid: PropTypes.bool, + size: PropTypes.oneOf(SIZES), + subdued: PropTypes.bool, + title: PropTypes.string.isRequired, +}; + +ChoiceTile.defaultProps = { + checked: false, +}; + +export default ChoiceTile; From a3e5dd7904b5d4c311749dca03967b426a3b7ca1 Mon Sep 17 00:00:00 2001 From: Mike Mangialardi Date: Mon, 18 May 2020 17:04:51 -0400 Subject: [PATCH 3/8] Create demo --- src/Choice Tile/stories.js | 63 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/Choice Tile/stories.js diff --git a/src/Choice Tile/stories.js b/src/Choice Tile/stories.js new file mode 100644 index 0000000..8673c71 --- /dev/null +++ b/src/Choice Tile/stories.js @@ -0,0 +1,63 @@ +import React from 'react'; +import { optionsKnob as options } from '@storybook/addon-knobs'; +import { boolean, select, text } from '@storybook/addon-knobs/react'; +import { storiesOf } from '@storybook/react'; + +import ChoiceTile from './index'; +import { getShortText } from '../storyUtils'; + +const SIZES = { + small: 'small', + medium: 'medium', + large: 'large', +}; + +storiesOf('Choice Tile', module).add('All Knobs', () => { + let description = text('description', ''); + let title = text('title', ''); + let checked = boolean('checked', false); + let disabled = boolean('disabled', false); + let invalid = boolean('invalid', false); + let subdued = boolean('subdued', false); + let size = select('size', SIZES, 'medium'); + let icon = options( + 'icon', + { + account: 'account', + bell: 'bell', + key: 'key', + }, + 'key', + { display: 'inline-radio' } + ); + + const defaultDescription = getShortText(); + const defaultTitle = 'Title Here'; + + return ( + + + {

{description || defaultDescription}

} +
+ + + {

{defaultDescription}

} +
+
+ ); +}); From a3ea1ded46e1f7c522591eeb2c92ef3f48891bdc Mon Sep 17 00:00:00 2001 From: Mike Mangialardi Date: Mon, 18 May 2020 17:32:35 -0400 Subject: [PATCH 4/8] Move class name to top level --- src/Choice Tile/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Choice Tile/index.js b/src/Choice Tile/index.js index ee48b4d..2af217b 100644 --- a/src/Choice Tile/index.js +++ b/src/Choice Tile/index.js @@ -20,7 +20,7 @@ const ChoiceTile = ({ ...rest }) => { return ( -