Created
August 26, 2017 14:06
-
-
Save shalvah/51fdabcb6371b5e5814421138dbe3969 to your computer and use it in GitHub Desktop.
Card.js
This file contains 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'; | |
class Card extends React.Component { | |
constructor() { | |
super(); | |
this.state = { | |
colors: ['blue-grey', 'red', 'brown' ] | |
} | |
} | |
render() { | |
let color = this.state.colors[Math.floor(Math.random()* this.state.colors.length)]; | |
let className = `card darken-1 ${color}`; | |
return ( | |
<div className="row"> | |
<div className="col s12 m6"> | |
<div className={className}> | |
<div className="card-content white-text"> | |
<p>{this.props.text}</p> | |
</div> | |
</div> | |
</div> | |
</div> | |
); | |
} | |
} | |
export default Card; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment