From 62fc52b97c7ce5f4d9b65d07d63dda39f1b2fd4e Mon Sep 17 00:00:00 2001 From: Lynn Date: Mon, 17 Jan 2022 13:34:32 +0100 Subject: [PATCH] Nav for settings --- src/App.tsx | 38 +++++++++++++++++++++++++++++++------- src/Game.tsx | 5 ----- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index ca867c1..fe0a131 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -74,17 +74,40 @@ function About() { ); } +function Settings() { + return <>TODO: dark theme, hard mode, etc.; +} + function App() { - const [about, setAbout] = useState(false); + const [page, setPage] = useState<"game" | "about" | "settings">("game"); return (

hello wordl

- setAbout((a) => !a)}> - {about ? "Close" : "About"} - + {page !== "game" ? ( + setPage("game")}> + Close + + ) : ( + <> + setPage("about")}> + Help + + {" • "} + setPage("settings")}> + Settings + + + )}
-
+
@@ -97,8 +120,9 @@ function App() { {seed ? "Random" : "Today's"}
- {about && } -
); } diff --git a/src/Game.tsx b/src/Game.tsx index afd848a..c7beaf1 100644 --- a/src/Game.tsx +++ b/src/Game.tsx @@ -30,7 +30,6 @@ function Game(props: GameProps) { const [currentGuess, setCurrentGuess] = useState(""); const [wordLength, setWordLength] = useState(5); const [hint, setHint] = useState(`Make your first guess!`); - const [srStatus, setSrStatus] = useState(``); const [target, setTarget] = useState(() => { resetRng(); return randomTarget(wordLength); @@ -59,7 +58,6 @@ function Game(props: GameProps) { (guess + key.toLowerCase()).slice(0, wordLength) ); setHint(""); - setSrStatus(""); } else if (key === "Backspace") { setCurrentGuess((guess) => guess.slice(0, -1)); setHint(""); @@ -182,9 +180,6 @@ function Game(props: GameProps) { {tableRows}

{hint || `\u00a0`}

- {/*

- {srStatus} -

*/} {seed ? (