Last active
April 3, 2018 15:26
-
-
Save siakaramalegos/9b5739f5ae04ece7969b6fb8e7ba7df7 to your computer and use it in GitHub Desktop.
refactor of slack stuff
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
class MyComponent extends Component { | |
render() { | |
const cards = this.props.data.map(card => ( | |
<Card card={card} key={card.id} /> | |
)) | |
return ( | |
<div style={contentStyles.root}> | |
{cards} | |
</div> | |
) | |
} | |
} | |
class Card extends Component { | |
constructor() { | |
super() | |
this.state = {isFlipped: false} | |
} | |
handleClick = (e) => { | |
// do things | |
} | |
render() { | |
const {definition, term} = this.props.card | |
return ( | |
<ReactCardFlip | |
isFlipped={this.state.isFlipped} | |
flipSpeedBackToFront={1.0} | |
flipSpeedFrontToBack={1.0} | |
> | |
<div key="front" onClick={this.handleClick}> | |
<Paper style={contentStyles.paper}> | |
<span>{data.definition} </span> | |
</Paper> | |
</div> | |
<div key="back" onClick={this.handleClick}> | |
<Paper style={contentStyles.paper}> | |
<span>{data.term}</span> | |
</Paper> | |
</div> | |
</ReactCardFlip> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment