From 34bd36e7455357649cd5c904f86630345ffe501e Mon Sep 17 00:00:00 2001 From: Ryan Yang Date: Sat, 11 May 2024 12:44:46 -0700 Subject: [PATCH] some UX improvements to color game --- src/app/pages/ColorGame/ColorGame.jsx | 4 +- src/app/pages/ColorGame/ColorGame.module.scss | 3 +- .../HexColorInput/HexColorInput.jsx | 14 +++- .../HexColorInput/HexColorInput.module.scss | 39 +++++++++--- .../components/Instructions/Instructions.jsx | 33 ++++++++++ .../Instructions/Instructions.module.scss | 32 ++++++++++ .../components/Instructions/breakdown.png | Bin 0 -> 4547 bytes .../Instructions/transformation.png | Bin 0 -> 9708 bytes .../components/Leaderboard/Leaderboard.jsx | 22 +++---- .../ColorGame/components/Results/Results.jsx | 33 +++++++++- .../components/Results/Results.module.scss | 60 +++++++++++++++++- 11 files changed, 210 insertions(+), 30 deletions(-) create mode 100644 src/app/pages/ColorGame/components/Instructions/Instructions.jsx create mode 100644 src/app/pages/ColorGame/components/Instructions/Instructions.module.scss create mode 100644 src/app/pages/ColorGame/components/Instructions/breakdown.png create mode 100644 src/app/pages/ColorGame/components/Instructions/transformation.png diff --git a/src/app/pages/ColorGame/ColorGame.jsx b/src/app/pages/ColorGame/ColorGame.jsx index c9d3db4a..4f58bb92 100644 --- a/src/app/pages/ColorGame/ColorGame.jsx +++ b/src/app/pages/ColorGame/ColorGame.jsx @@ -9,6 +9,7 @@ import { } from "./components/HexColorInput/HexColorInput"; import { Results } from "./components/Results/Results"; import Auto from "react-animate-height"; +import { Instructions } from "./components/Instructions/Instructions"; const generateRandomHexString = () => { const randomHex = []; @@ -24,6 +25,7 @@ export const ColorGame = memo(function ColorGame() { const [color, setColor] = useState(generateRandomHexString); const [report, setReport] = useState(); const [height, setHeight] = useState("auto"); + const contentRef = useRef(null); const resetColor = useCallback( () => setColor(generateRandomHexString()), @@ -41,7 +43,6 @@ export const ColorGame = memo(function ColorGame() { return () => resizeObserver.disconnect(); }, []); - const contentRef = useRef(null); return (
@@ -72,6 +73,7 @@ export const ColorGame = memo(function ColorGame() { {report && } +
); }); diff --git a/src/app/pages/ColorGame/ColorGame.module.scss b/src/app/pages/ColorGame/ColorGame.module.scss index 2c0be4b8..e2aaa710 100644 --- a/src/app/pages/ColorGame/ColorGame.module.scss +++ b/src/app/pages/ColorGame/ColorGame.module.scss @@ -12,7 +12,7 @@ gap: 20px; margin: 0 auto; - padding: 20px; + padding: 20px 20px 80px; box-sizing: border-box; @@ -31,6 +31,7 @@ width: 200px; border-radius: 8px; margin-bottom: 0px; + transition: width 250ms; } @media screen and (max-width: 900px) { diff --git a/src/app/pages/ColorGame/components/HexColorInput/HexColorInput.jsx b/src/app/pages/ColorGame/components/HexColorInput/HexColorInput.jsx index b5d7705f..2a89dbd7 100644 --- a/src/app/pages/ColorGame/components/HexColorInput/HexColorInput.jsx +++ b/src/app/pages/ColorGame/components/HexColorInput/HexColorInput.jsx @@ -1,4 +1,4 @@ -import { createRef, memo, useMemo, useState } from "react"; +import { createRef, memo, useEffect, useMemo, useState } from "react"; import cn from "./HexColorInput.module.scss"; import clsx from "clsx"; import { generateReport } from "./generateReport"; @@ -36,10 +36,15 @@ export const HexColorInput = memo(function HexColorInput({ resetColor, }) { const [guess, setGuess] = useState(EMPTY_GUESS); + const [showErrorMessage, setErrorMessage] = useState(false); const [input] = useState(() => Array.from({ length: 6 }, createRef)); const guessIsValid = useMemo(() => guess.join("").length === 6, [guess]); + useEffect(() => { + if (showErrorMessage) setTimeout(() => setErrorMessage(false), 2500); + }, [showErrorMessage]); + const ignoreEvent = (event) => { event.preventDefault(); }; @@ -61,7 +66,7 @@ export const HexColorInput = memo(function HexColorInput({ const handleInput = (index) => (event) => { const userKeyInput = event.nativeEvent.data.toUpperCase(); - if (!DIGITS.includes(userKeyInput)) return; + if (!DIGITS.includes(userKeyInput)) return setErrorMessage(true); setGuess((prev) => { const next = [...prev]; @@ -96,7 +101,7 @@ export const HexColorInput = memo(function HexColorInput({ return; case "ArrowRight": - if (index > 5) return; + if (index > 4) return; focusEndOfInput(input[index + 1].current); return; @@ -144,6 +149,9 @@ export const HexColorInput = memo(function HexColorInput({ refresh +
+ Only 0-9 and A-F are valid hex values. +
); }); diff --git a/src/app/pages/ColorGame/components/HexColorInput/HexColorInput.module.scss b/src/app/pages/ColorGame/components/HexColorInput/HexColorInput.module.scss index bb71bf4f..c34d0c61 100644 --- a/src/app/pages/ColorGame/components/HexColorInput/HexColorInput.module.scss +++ b/src/app/pages/ColorGame/components/HexColorInput/HexColorInput.module.scss @@ -4,6 +4,7 @@ grid-template-columns: auto auto; gap: 20px; min-width: 600px; + transition: width 250ms; @media screen and (max-width: 1000px) { grid-template-columns: auto; @@ -16,7 +17,7 @@ } } - + .actions { display: grid; grid-template-columns: auto auto; @@ -27,7 +28,7 @@ display: grid; grid-template-columns: repeat(7, 32px); gap: 8px; - + input { border: none; border-bottom: 2px solid var(--gray); @@ -37,15 +38,15 @@ &::placeholder { opacity: 0.1; } - + &.underline { color: var(--gray); border: none; } } } - - button{ + + button { border: 2px solid var(--silver); padding: 0 20px; border-radius: 8px; @@ -57,12 +58,12 @@ color: var(--silver); font-weight: bold; cursor: not-allowed; - + &.allowed { color: var(--green); border-color: var(--green); cursor: pointer; - + &:hover { background-color: var(--green); color: var(--white); @@ -84,4 +85,26 @@ } } -} + + .error { + display: grid; + grid-column: 1 / 3; + color: transparent; + + transition: color 250ms; + font-size: 0.9em; + text-align: center; + + height: 0; + overflow: visible; + + &.visible { + color: var(--red); + } + + @media screen and (max-width: 1000px) { + height: auto; + grid-column: 1/ 2; + } + } +} \ No newline at end of file diff --git a/src/app/pages/ColorGame/components/Instructions/Instructions.jsx b/src/app/pages/ColorGame/components/Instructions/Instructions.jsx new file mode 100644 index 00000000..4a141ef0 --- /dev/null +++ b/src/app/pages/ColorGame/components/Instructions/Instructions.jsx @@ -0,0 +1,33 @@ +import clsx from "clsx"; +import { memo, useRef } from "react"; +import cn from "./Instructions.module.scss"; +import { Text } from "app/components"; +import COLOR_BREAKDOWN from "./breakdown.png"; + +export const Instructions = memo(function Instructions() { + return ( +
+
+ + How to play + +
+

+ Hex colors are made up of 6 hexadecimal characters (hexadecimals + are numbers that go from 0-9, A, B, C, D, E, F, rather than just + 0-9 in our normal decimal system) and are split into 3 sections: + Red, Green and Blue - commonly known as RGB. +

+ color hex code with individual groups color coded with highlights +

+ Each hex color is essentially a blend of these three primary + colors. Compared to traditional print (CYMK), adding more of + each color makes the overall color brighter so #FFFFFF would be + white and #000000 would be black. +

+
+ ); +}); diff --git a/src/app/pages/ColorGame/components/Instructions/Instructions.module.scss b/src/app/pages/ColorGame/components/Instructions/Instructions.module.scss new file mode 100644 index 00000000..12921d2e --- /dev/null +++ b/src/app/pages/ColorGame/components/Instructions/Instructions.module.scss @@ -0,0 +1,32 @@ +.container { + padding: 20px; + border: 2px solid var(--silver); + border-radius: 18px; + // width: min-content; + + .header { + display: grid; + grid-template-columns: 1fr auto; + width: 100%; + } + + p { + margin: 20px 0; + line-height: 1.3em; + width: fit-content; + font-size: 1.3em; + + @media screen and (max-width: 1000px) { + font-size: 1em; + } + + } + img { + margin: 0 auto; + max-height: 200px; + + @media screen and (max-width: 1000px) { + max-height: 100px; + } + } +} \ No newline at end of file diff --git a/src/app/pages/ColorGame/components/Instructions/breakdown.png b/src/app/pages/ColorGame/components/Instructions/breakdown.png new file mode 100644 index 0000000000000000000000000000000000000000..79d5506114f72fe339af2f1810db5ce7dd13c323 GIT binary patch literal 4547 zcmeHLX;f2Lmwh0Gs6j|y!Y-s@1Aw@a9H){C1&GzVo_ui3v;x- z2-Nf_&4@Y@$O~6506=Z}o-MCm06@mo=GP0?qr~Rfo$2m_1v?j=0(qU7{5JcMaQiOb z8y#1~Wi3z0cc-R2d}?`64}0Mw0wMqAIOV-g6$q!5EB)sa#2&2!>KAwa>7Xxz6GLUT zUdjNE%-8FIVG04?tz8zl1iZTrGcZzau!ihh#BkU}u^;q{47s;ez1%?R)j9zHR->-s zK*9;II1rrSDFvKADQf+(OBC51mTc19=yOf)pXF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}{!U`!+MzqC19$vf{$R6)nja7p3yjj_eMJmK;y9$s&OKv9I-cQ@tMvQTZ(w9$Fwq8z zw!QPhjr>kogIQndT}AV`BxLA1gg!ub#XbRR~3YF(?Xvpzl zQtj&kXpAj*xg!xW_-6=k$)T@89~yYE{lkvKmEuRVBHRCbHPQ#ZgL<3L=l^z+;NQNp zA=i=hid~?UPE8QxuT<-75Cz>nbUWK6p!&OxaN+tt8n8W~fq{mgC3)e%hp7!kbk*_w-I!fiedfcs z!wEXkz06Vyy|Nm!6^pn3{T_d~I`PaOE2&pQkHRt?as$mrZHb~4%Ssx zTddHD&(h7d0WUHJ&J$F{4-RUqHf4pAQhJXw!9w#YZ61A93Aituc7D}JKznQjv#SuH z(E=LM*w-(@+_S{PLEpVt>Ea!ztF3>UajQu>J0Q(4Pdh+Be~d)fJ)3v|>Rw|dDxXcV zeC7*eg~5I(2>dldzCU%LSc##YV2p#W67qj{;6a0(%r!QBvp6dYaTW$seB2)U*>*h( zx%9`a7*2ZenNpmogOW&Sx?HS+$^tF=%4-Iq51UHL&FgO3YcHNbJ;L8Tqg3dA1Vx38 z4H(O_GMCje4BLh~-6>)Gzr28`;bpMBlvjpHne1w*Px}=70VngSkUkqT7A-g~X~uh_KY| MY2GcnWBua40CbU<`2YX_ literal 0 HcmV?d00001 diff --git a/src/app/pages/ColorGame/components/Leaderboard/Leaderboard.jsx b/src/app/pages/ColorGame/components/Leaderboard/Leaderboard.jsx index 0d395f07..2e209325 100644 --- a/src/app/pages/ColorGame/components/Leaderboard/Leaderboard.jsx +++ b/src/app/pages/ColorGame/components/Leaderboard/Leaderboard.jsx @@ -6,7 +6,7 @@ import Auto from "react-animate-height"; import { Text } from "app/components"; import { ScoreItem } from "./components/ScoreItem"; -const PADDING = 40; +const PADDING = 16; const HIGHSCORE_LOCALSTORAGE_KEY = "@duci/color-game-highscore"; export const Leaderboard = memo(function Leaderboard({ report }) { @@ -45,16 +45,12 @@ export const Leaderboard = memo(function Leaderboard({ report }) { }, []); return ( - -
- - High Scores - -
+
+ + High Scores + + +
{!highscores.length && (
No previous scores to show. @@ -64,7 +60,7 @@ export const Leaderboard = memo(function Leaderboard({ report }) { ))}
-
-
+ +
); }); diff --git a/src/app/pages/ColorGame/components/Results/Results.jsx b/src/app/pages/ColorGame/components/Results/Results.jsx index a322db08..67e6a8c9 100644 --- a/src/app/pages/ColorGame/components/Results/Results.jsx +++ b/src/app/pages/ColorGame/components/Results/Results.jsx @@ -3,14 +3,43 @@ import { memo } from "react"; import cn from "./Results.module.scss"; export const Results = memo(function Results({ report }) { + const actualColor = "#" + report.actual; + const guessColor = "#" + report.guess; + return (
You were {report.similarityPercentage.toFixed(2)}% of the way there! -
answer: #{report.actual}
-
you guessed: #{report.guess}
+
+
+
+ + ANSWER + +
+

{actualColor}

+
+
+
+
+
+
+ + GUESS + +
+

{guessColor}

+
+
+
); }); diff --git a/src/app/pages/ColorGame/components/Results/Results.module.scss b/src/app/pages/ColorGame/components/Results/Results.module.scss index f2a35521..cb866001 100644 --- a/src/app/pages/ColorGame/components/Results/Results.module.scss +++ b/src/app/pages/ColorGame/components/Results/Results.module.scss @@ -1,6 +1,62 @@ .container { text-align: center; - margin: 40px; display: grid; - gap: 8px; + margin-top: 20px; + + background-color: var(--silver); + border-radius: 8px; + width: 100%; + padding: 40px; + + .split { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 20px; + padding-top: 20px; + + .left { + text-align: left; + display: grid; + grid-template-columns: 1fr auto; + + .description { + display: grid; + place-content: center start; + } + } + + .right { + text-align: right; + display: grid; + grid-template-columns: auto 1fr; + + .description { + display: grid; + place-content: center end; + } + } + + .color { + font-size: 3em; + } + .box { + height: 120px; + width: 120px; + border-radius: 8px; + + } + @media screen and (max-width: 900px) { + grid-template-columns: 1fr; + + .box { + height: 60px; + width: 60px; + } + // .right + + .color { + font-size: 2em; + } + } + } } \ No newline at end of file