diff --git a/src/Choice Tile/index.js b/src/Choice Tile/index.js new file mode 100644 index 0000000..269d45b --- /dev/null +++ b/src/Choice Tile/index.js @@ -0,0 +1,64 @@ +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, + invalid, + name, + onChange, + size, + subdued, + title, + ...rest +}) => { + return ( + + ); +}; + +ChoiceTile.propTypes = { + checked: PropTypes.bool.isRequired, + children: PropTypes.node, + className: PropTypes.string, + disabled: PropTypes.bool, + icon: PropTypes.string, + invalid: PropTypes.bool, + name: PropTypes.string.isRequired, + onChange: PropTypes.func, + size: PropTypes.oneOf(SIZES), + subdued: PropTypes.bool, + title: PropTypes.string.isRequired, +}; + +ChoiceTile.defaultProps = { + checked: false, +}; + +export default ChoiceTile; diff --git a/src/Choice Tile/stories.js b/src/Choice Tile/stories.js new file mode 100644 index 0000000..7051c5c --- /dev/null +++ b/src/Choice Tile/stories.js @@ -0,0 +1,65 @@ +import React from 'react'; +import { action } from '@storybook/addon-actions'; +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}

} +
+
+ ); +}); 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