Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. import React from 'react';
  2. import styles from './styles.css'
  3.  
  4. /**
  5. * @return {string}
  6. */
  7. function GetCoords(x, y) {
  8. /*
  9. const cells = [];
  10. for (let i = 0; i < amount; i++) {
  11. cells.push(<div className={ styles.cell }></div>);
  12. }
  13.  
  14. */
  15. //calc(15px + 106.25px * 3 + 15px * 3); top: calc(15px + 106.25px + 15px)
  16. debugger;
  17. return `calc(15px + 106.25px * ${y} + 15px * ${y}); top: calc(15px + 106.25px * ${x}+ 15px * ${x})`
  18.  
  19. //return <div className="cells">{cells}</div>;
  20. }
  21.  
  22.  
  23.  
  24. export default class Tile extends React.Component {
  25. constructor({x, y, value}) {
  26. super()
  27. this.state = {
  28. x: x,
  29. y: y,
  30. value: value
  31. };
  32. }
  33.  
  34.  
  35.  
  36. render () {
  37. var a = GetCoords(this.state.x, this.state.y).toString();
  38.  
  39. debugger
  40.  
  41. return (
  42. <div className= {styles.tile}
  43. style = {a}
  44. >{this.state.value}</div>
  45. );
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement