Skip to content

Instantly share code, notes, and snippets.

@pavelvlasov
Created July 24, 2018 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavelvlasov/c407b54edea3c1e64863f7121f4f0994 to your computer and use it in GitHub Desktop.
Save pavelvlasov/c407b54edea3c1e64863f7121f4f0994 to your computer and use it in GitHub Desktop.
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