Skip to content

Instantly share code, notes, and snippets.

@rewmike
Last active May 17, 2016 20:09
Show Gist options
  • Save rewmike/bd9da4020b16d461c5749305f980f758 to your computer and use it in GitHub Desktop.
Save rewmike/bd9da4020b16d461c5749305f980f758 to your computer and use it in GitHub Desktop.
Common stuff
import sizePropType from '../propTypes/size';
import sizeClass from '../utils/sizeClass';
const Component = ({ size }) => {
let classNames = '';
if (size) classNames += ' ' + sizeClass(size);
return <div className={classNames} />;
};
Component.propTypes = {
size: sizePropType.isRequired
};
Component.defaultProps = {
size: '4'
};
export default Component;
import { PropTypes } from 'react';
export default PropTypes.oneOf(['1', '2', '3', '4', '5']);
export default function (size) => 'S' + size;
@rewmike
Copy link
Author

rewmike commented May 17, 2016

*** completely un-tested

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