/ProgressModal.js Secret
Last active
January 28, 2024 19:03
Wordle in React part 2 - adding squares-string logic to Modal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function ProgressModal({ ..., squaresString, gameNo }) { | |
... | |
function shareResult() { | |
// to differentiate between winning on 6th try and losing | |
let turnIndex = isCorrect ? turn : 0; | |
let resultString = "" | |
for (let i = 0; i < turnIndex; i++){ | |
let newRow = squaresString[i] + "\n"; | |
resultString += newRow; | |
} | |
let prefix= `Wordlestruck ${gameNo} ${turnIndex===0?'X':turnIndex}/6\n\n` | |
resultString = prefix + resultString | |
... | |
<...copy to clipboard code...> | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment