Skip to content

Commit

Permalink
feat: tic tac toe pieces
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoCSolari committed Aug 24, 2022
1 parent ab8de78 commit 2412804
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
10 changes: 0 additions & 10 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
Expand Down
1 change: 1 addition & 0 deletions src/assets/mouse-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 16 additions & 3 deletions src/components/TicTacToe/components/BoardSquare.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Box } from "@chakra-ui/react";
import React from "react";
import { Box, Img } from "@chakra-ui/react";
import React, { useState } from "react";
import mouseIcon from "../../../assets/mouse-icon.svg";
import cheddarIcon from "../../../assets/cheddar-icon.svg";

type Props = {
column: number;
Expand All @@ -14,11 +16,13 @@ type Props = {
};

export function BoardSquare({ column, row, squareSize }: Props) {
const [showIcon, setShowIcon] = useState(false);
const border = "5px solid";
const borderColor = "purpleCheddar";

const handleClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
console.log(e.currentTarget.id);
setShowIcon((prevState) => !prevState);
};
return (
<Box
Expand All @@ -36,7 +40,16 @@ export function BoardSquare({ column, row, squareSize }: Props) {
w="100%"
h="100%"
onClick={handleClick}
></Box>
>
{showIcon && (
<Img
src={(column + row) % 2 === 0 ? mouseIcon : cheddarIcon}
alt=""
width="100%"
height="100%"
/>
)}
</Box>
</Box>
);
}
4 changes: 1 addition & 3 deletions src/components/TicTacToe/containers/TicTacToe.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Button, Grid } from "@chakra-ui/react";
import { useContext } from "react";
import { useWalletSelector } from "../../../contexts/WalletSelectorContext";
import { Grid } from "@chakra-ui/react";
import useScreenSize from "../../../hooks/useScreenSize";
import Board from "../components/Board";
import Info from "../components/Info";
Expand Down

0 comments on commit 2412804

Please sign in to comment.