From f82ec63eb9f4f82d3be81d604405d7f86e839fbc Mon Sep 17 00:00:00 2001 From: Muhammad Zourdy Date: Sun, 7 Aug 2022 08:18:04 +0200 Subject: [PATCH] Add `game-with-hooks` game module --- .../game-area/game-section-example.tsx | 2 +- .../scoreboard/components/level/level.tsx | 5 +-- src/components/scoreboard/scoreboard.test.tsx | 4 +-- src/components/scoreboard/scoreboard.tsx | 17 +++++++-- src/index.tsx | 7 ++-- src/modules/GameWithHooks/GameWithHooks.tsx | 35 +++++++++++++++++++ src/modules/GameWithHooks/index.ts | 1 + 7 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 src/modules/GameWithHooks/index.ts diff --git a/src/components/game-area/game-section-example.tsx b/src/components/game-area/game-section-example.tsx index dc99692b..f87484c2 100644 --- a/src/components/game-area/game-section-example.tsx +++ b/src/components/game-area/game-section-example.tsx @@ -18,7 +18,7 @@ export const GameSectionExample: FunctionComponent = () => { mines="000" levels={["beginner", "intermediate", "expert"]} onReset={() => null} - onChange={() => null} + onChangeLevel={() => null} /> null} isWin={true} /> null} onContextMenu={() => null} /> diff --git a/src/components/scoreboard/components/level/level.tsx b/src/components/scoreboard/components/level/level.tsx index fd1f8427..828a621a 100644 --- a/src/components/scoreboard/components/level/level.tsx +++ b/src/components/scoreboard/components/level/level.tsx @@ -5,8 +5,9 @@ import styles from "./level.module.scss"; export const Level: FunctionComponent<{ levelData: string[]; onChange: (event: ChangeEvent) => void; -}> = ({ levelData, onChange }) => ( - {levelData.map((item: string) => { return (