diff --git a/web/.eslintrc.js b/web/.eslintrc.js index 9700d32..7fd62a1 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -13,5 +13,12 @@ module.exports = { jest: true, }, ignorePatterns: [".eslintrc.js", "dist/"], - rules: {}, + rules: { + "prettier/prettier": [ + "error", + { + endOfLine: "auto", + }, + ], + }, }; diff --git a/web/src/App.scss b/web/src/App.scss index 56dbdc3..55aefe1 100644 --- a/web/src/App.scss +++ b/web/src/App.scss @@ -1,3 +1,6 @@ @use "node_modules/@picocss/pico/scss/pico" with ( $theme-color: "pumpkin" -); \ No newline at end of file +); + +@import "./pages/game/GamePage.scss"; +@import "./pages/game/components/GameBoard.scss"; diff --git a/web/src/App.tsx b/web/src/App.tsx index 9e26c1a..8778670 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -1,20 +1,15 @@ -import React from "react"; import { io } from "socket.io-client"; +import GamePage from "./pages/game/GamePage"; function App() { const socket = io("http://localhost:3010"); - const emitData = () => - console.log(socket.emit("example-request", "custom-request")); socket.on("example-response", (data) => console.log(`Received response in front end with data: ${data}`), ); return (
-
- - Hello World! Front -
+
); } diff --git a/web/src/pages/game/GamePage.scss b/web/src/pages/game/GamePage.scss new file mode 100644 index 0000000..1cbf756 --- /dev/null +++ b/web/src/pages/game/GamePage.scss @@ -0,0 +1,5 @@ +h1 { + text-align: center; + padding: 10px; + margin: 0; +} diff --git a/web/src/pages/game/GamePage.tsx b/web/src/pages/game/GamePage.tsx new file mode 100644 index 0000000..663aefc --- /dev/null +++ b/web/src/pages/game/GamePage.tsx @@ -0,0 +1,15 @@ +import React from "react"; +import GameBoard from "./components/GameBoard"; + +const GamePage = () => { + return ( + +

Game Page Title

+
+ +
+
+ ); +}; + +export default GamePage; diff --git a/web/src/pages/game/components/GameBoard.scss b/web/src/pages/game/components/GameBoard.scss new file mode 100644 index 0000000..477f4cc --- /dev/null +++ b/web/src/pages/game/components/GameBoard.scss @@ -0,0 +1,79 @@ +.game-board { + height: 700px; + width: 700px; + display: grid; + grid-template-columns: repeat(11, auto); + gap: auto; + padding: 10px; + + .cell { + width: 60px; + height: 60px; + border: 2px solid black; + border-radius: 10%; + } + + .v-exit { + width: 60px; + height: 30px; + + > div { + width: 20px; + height: 100%; + margin: auto; + border: solid black; + border-width: 0 1px; + + .dotted { + margin: auto; + border: dashed black; + border-width: 0 1px; + height: 100%; + width: 0; + } + } + + &:has(.v-exit-up) { + margin-bottom: -9px; + } + + &:has(.v-exit-down) { + margin-top: -9px; + } + } + + .h-exit { + height: 60px; + width: 30px; + + > div { + height: 20px; + width: 100%; + margin: auto; + border: solid black; + border-width: 1px 0; + position: relative; + top: 50%; + transform: translateY(-50%); + + .dotted { + margin: auto; + border: dashed black; + border-width: 1px 0; + width: 100%; + height: 0; + position: relative; + top: 50%; + transform: translateY(-50%); + } + } + + &:has(.h-exit-left) { + margin-right: -9px; + } + + &:has(.h-exit-right) { + margin-left: -9px; + } + } +} \ No newline at end of file diff --git a/web/src/pages/game/components/GameBoard.tsx b/web/src/pages/game/components/GameBoard.tsx new file mode 100644 index 0000000..31078b1 --- /dev/null +++ b/web/src/pages/game/components/GameBoard.tsx @@ -0,0 +1,76 @@ +const GameBoard = () => { + const range = (n: number) => Array.from(Array(n).keys()); + const cells = range(11).flatMap((rowIndex) => { + return range(11).map((colIndex) => { + return { rowIndex, colIndex }; + }); + }); + + return ( +
+ {cells.map(({ rowIndex, colIndex }) => { + if ( + (rowIndex === 0 || rowIndex === 10) && + (colIndex === 0 || colIndex === 10) + ) { + return
; + } + if (rowIndex === 0) { + return ( +
+
+
+
+
+ ); + } + if (rowIndex === 10) { + return ( +
+
+
+
+
+ ); + } + if (colIndex === 0) { + return ( +
+
+
+
+
+ ); + } + if (colIndex === 10) { + return ( +
+
+
+
+
+ ); + } + return
; + })} +
+ ); + + /* + {range(9).map(() => ( +
+
+
+ ))} + {range(81).map(() => ( +
+ ))} + {range(9).map(() => ( +
+
+
+ ))} + */ +}; + +export default GameBoard;