From 7ffcd59d27d46e6fcb453f96d61ffb0cabbeb1e6 Mon Sep 17 00:00:00 2001 From: quentin Date: Wed, 5 Mar 2025 15:41:20 +0100 Subject: [PATCH] responsiveness of solution --- src/assets/icons/circle-arrow-down.svg | 1 + src/objects/Game/Game.css | 16 +++++++++++++ src/objects/Game/Game.tsx | 33 ++++++++++++++++---------- 3 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 src/assets/icons/circle-arrow-down.svg diff --git a/src/assets/icons/circle-arrow-down.svg b/src/assets/icons/circle-arrow-down.svg new file mode 100644 index 0000000..538818a --- /dev/null +++ b/src/assets/icons/circle-arrow-down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/objects/Game/Game.css b/src/objects/Game/Game.css index 6aa0cc7..8d3bd37 100644 --- a/src/objects/Game/Game.css +++ b/src/objects/Game/Game.css @@ -28,6 +28,18 @@ background-color: lightgray; } +#lose-header { + display: flex; + width: 100%; + align-items: center; + justify-content: center; + gap: 2em; +} + +#lose-header .scroll-arrow { + width: 3em; +} + @media (max-width: 720px) { #game { width: calc(500px / 1.5); @@ -44,4 +56,8 @@ width: 100%; flex-direction: row; } + + #lose-header .scroll-arrow { + width: calc(3em / 1.5); + } } \ No newline at end of file diff --git a/src/objects/Game/Game.tsx b/src/objects/Game/Game.tsx index 2b152a0..b710cd3 100644 --- a/src/objects/Game/Game.tsx +++ b/src/objects/Game/Game.tsx @@ -14,7 +14,9 @@ interface GameProps { function Game(props: GameProps) { //TODO manage number of lines and number of colors + // eslint-disable-next-line react-hooks/rules-of-hooks const [activeLine, setActiveLine] = useState(0) + // eslint-disable-next-line react-hooks/rules-of-hooks const [valid, setValid] = useState(false) const initCases: CaseInfo[][] = [] @@ -54,16 +56,6 @@ function Game(props: GameProps) { setCases((prev) => [...prev.slice(0, activeLine), currentLine, ...prev.slice(activeLine+1)]) } - const win = valid ?

Congratulations ! you won in {activeLine+1} try(s) !

:

Trys : {activeLine}

; - const lose = !valid && activeLine >= props.nLines ?

You lost !

-

Combination was :

-
- {props.combination.map( - (color, idx) => ) - } -
-
: null; - return ( <>
@@ -86,8 +78,25 @@ function Game(props: GameProps) { }
- {win} - {lose} + + + + + + + ) }