Created
July 24, 2018 02:34
-
-
Save pavelvlasov/c407b54edea3c1e64863f7121f4f0994 to your computer and use it in GitHub Desktop.
Tile component
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
class Tile extends React.Component { | |
static propTypes = { | |
src: PropTypes.string.isRequired, | |
tile: PropTypes.object.isRequired, | |
state: PropTypes.number.isRequired, | |
scale: PropTypes.number.isRequired | |
}; | |
render() { | |
const { src, tile, state, scale } = this.props; | |
const left = tile.width * state; | |
return ( | |
<Container width={tile.width} height={tile.height} scale={scale}> | |
<Image src={src} left={left} /> | |
</Container> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment