Skip to content

Instantly share code, notes, and snippets.

@pavelvlasov pavelvlasov/tile.js
Created Jul 24, 2018

Embed
What would you like to do?
Tile component
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
You can’t perform that action at this time.