Created
July 11, 2015 21:10
-
-
Save joshblack/eb0c7c374c0eeaf05295 to your computer and use it in GitHub Desktop.
React Components
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 Radium from 'radium'; | |
| import { PropTypes } from 'react'; | |
| export default class Image { | |
| static propTypes = { | |
| src: PropTypes.string.isRequired, | |
| alt: PropTypes.string.isRequired | |
| } | |
| render() { | |
| return ( | |
| <img | |
| src={this.props.src} | |
| alt={this.props.alt} | |
| style={{ width: '100%', height: '100%' }}/> | |
| ); | |
| } | |
| } |
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
| const rotate = Radium.keyframes({ | |
| '0%': { transform: 'rotate(0)' }, | |
| '100%': { transform: 'rotate(360deg)' } | |
| }); | |
| class Loader { | |
| static propTypes = { | |
| border: PropTypes.string, | |
| color: PropTypes.string, | |
| height: PropTypes.number, | |
| width: PropTypes.number | |
| } | |
| static defaultProps = { | |
| border: '2px', | |
| color: '#000000', | |
| height: 25, | |
| width: 25 | |
| } | |
| render() { | |
| return ( | |
| <div | |
| style={{ | |
| width: this.props.width, | |
| height: this.props.height, | |
| border: `${this.props.border} solid ${this.props.color}`, | |
| borderBottomColor: 'transparent', | |
| borderRadius: '50%', | |
| animation: `${rotate} .75s linear infinite` | |
| }} /> | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment