Created
April 16, 2017 20:03
-
-
Save colmtuite/26a3f9f61cdac1dd4723d90e7362b223 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import PropTypes from 'prop-types'; | |
| const alignment = { | |
| left: 'flex-start', | |
| center: 'center', | |
| right: 'flex-end' | |
| } | |
| const alignItems = alignment[align] | |
| var rootClasses = ` | |
| ta-right | |
| color-blue | |
| alignItems | |
| ` | |
| class Section extends React.Component { | |
| render() { | |
| return ( | |
| <button | |
| className={rootClasses}> | |
| {this.props.value} | |
| </button> | |
| ); | |
| } | |
| } | |
| Section.propTypes = { | |
| name: PropTypes.string.isRequired, | |
| align: PropTypes.oneOf(['left', 'center', 'right']), | |
| }; | |
| Section.defaultProps = { | |
| value: 'Hello', | |
| align: 'center', | |
| }; | |
| export default Section; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment