diff --git a/src/components/game-area/game-layout.tsx b/src/components/game-area/game-layout.tsx index 7e3e183d..c78fc62c 100644 --- a/src/components/game-area/game-layout.tsx +++ b/src/components/game-area/game-layout.tsx @@ -13,11 +13,11 @@ export interface Props { children: React.ReactNode; } -const WrapperContainer: FunctionComponent = ({ children }) => ( +export const WrapperContainer: FunctionComponent = ({ children }) => (
{children}
); -const GameArea: FunctionComponent = ({ children }) => ( +export const GameArea: FunctionComponent = ({ children }) => (
{children}
); diff --git a/src/components/game-area/game-over.tsx b/src/components/game-area/game-over.tsx new file mode 100644 index 00000000..c5f4ad57 --- /dev/null +++ b/src/components/game-area/game-over.tsx @@ -0,0 +1,12 @@ +import React, { FunctionComponent, PropsWithChildren } from "react"; + +import styles from "./game-section.module.scss"; + +interface GameOverProps { + isWin: boolean; + onClick: () => void; +} + +export const GameOver: FunctionComponent = ({ onClick, isWin }) => { + return
{isWin ? "😎" : "🙁"}
; +}; diff --git a/src/components/game-area/game-section-example.tsx b/src/components/game-area/game-section-example.tsx new file mode 100644 index 00000000..dc99692b --- /dev/null +++ b/src/components/game-area/game-section-example.tsx @@ -0,0 +1,28 @@ +import { GameArea, WrapperContainer } from "@components/game-area/game-layout"; +import { GameOver } from "@components/game-area/game-over"; +import { GridComponent } from "@components/grid"; +import { ScoreBoard } from "@components/scoreboard"; +import { Top } from "@components/top-section"; +import { Field, fieldGenerator } from "@helpers/field"; +import React, { FunctionComponent } from "react"; + +export const GameSectionExample: FunctionComponent = () => { + return ( + + + Minesweeper + + + null} + onChange={() => null} + /> + null} isWin={true} /> + null} onContextMenu={() => null} /> + + + ); +}; diff --git a/src/components/game-area/game-section.module.scss b/src/components/game-area/game-section.module.scss index 9dee8bbd..7097a19f 100644 --- a/src/components/game-area/game-section.module.scss +++ b/src/components/game-area/game-section.module.scss @@ -14,3 +14,22 @@ border: 6px solid #e3e3e3; background-color: #e3e3e3; } + +.gameOverComponent { + top: 60%; + left: 50%; + z-index: 11; + width: 8vw; + height: 8vw; + font-size: 4vw; + text-align: center; + user-select: none; + cursor: pointer; + line-height: 8vw; + position: absolute; + border-radius: 50%; + pointer-events: auto; + background-color: #d1d1d1; + transform: translate(-50%, -50%); + border: 1px solid rgba(51, 51, 51, 0.25); +} diff --git a/src/components/game-area/game-section.module.scss.d.ts b/src/components/game-area/game-section.module.scss.d.ts new file mode 100644 index 00000000..d89da6db --- /dev/null +++ b/src/components/game-area/game-section.module.scss.d.ts @@ -0,0 +1,16 @@ +// autogenerated by typings-for-css-modules-loader. +// Please do not change this file! +declare namespace GameSectionModuleScssNamespace { + export interface IGameSectionModuleScss { + gameArea: string; + gameOverComponent: string; + wrapperContainer: string; + } +} + +declare const GameSectionModuleScssModule: GameSectionModuleScssNamespace.IGameSectionModuleScss & { + /** WARNING: Only available when `css-loader` is used without `style-loader` or `mini-css-extract-plugin` */ + locals: GameSectionModuleScssNamespace.IGameSectionModuleScss; +}; + +export = GameSectionModuleScssModule; diff --git a/src/components/game-area/game-section.tsx b/src/components/game-area/game-section.tsx deleted file mode 100644 index e69de29b..00000000 diff --git a/src/components/game-area/index.ts b/src/components/game-area/index.ts new file mode 100644 index 00000000..e85a4ec7 --- /dev/null +++ b/src/components/game-area/index.ts @@ -0,0 +1,3 @@ +export { WrapperContainer, GameArea, GameLayout } from "./game-layout"; +export { GameOver } from "./game-over"; +export { GameSectionExample } from "./game-section-example"; diff --git a/src/index.tsx b/src/index.tsx index f13a84c3..c431fbca 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,8 +1,9 @@ import "@styles/styles.scss"; import "normalize.css/normalize.css"; -import { GridComponent } from "@components/grid"; -import { MockFieldData } from "@helpers/mockData"; +import { GameSectionExample } from "@components/game-area"; +// import { GridComponent } from "@components/grid"; +// import { MockFieldData } from "@helpers/mockData"; import React from "react"; import { createRoot } from "react-dom/client"; @@ -15,13 +16,7 @@ const root = createRoot(container); root.render( {/**/} - <> - {/**/} - {/* Minesweeper*/} - {/**/} - {/* null} levels={["beginner", "intermediate", "expert"]} mines="010" />*/} - null} onClick={() => null} /> - + {/**/} );