Add an "About" link
This commit is contained in:
15
src/App.css
15
src/App.css
@@ -25,14 +25,19 @@ body {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.App {
|
.App-container {
|
||||||
|
position: relative;
|
||||||
|
max-width: 500px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
max-width: 500px;
|
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.App-container h1 {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.Game {
|
.Game {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -152,4 +157,10 @@ a:active {
|
|||||||
.App-footer {
|
.App-footer {
|
||||||
margin: -1rem 0 2rem 0;
|
margin: -1rem 0 2rem 0;
|
||||||
font-size: 80%;
|
font-size: 80%;
|
||||||
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.App-about {
|
||||||
|
margin-top: -1rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
82
src/App.tsx
82
src/App.tsx
@@ -4,20 +4,84 @@ import { dictionarySet, pick } from "./util";
|
|||||||
import Game from "./Game";
|
import Game from "./Game";
|
||||||
import { names } from "./names";
|
import { names } from "./names";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { Row, RowState } from "./Row";
|
||||||
|
import { Clue } from "./clue";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
const [about, setAbout] = useState(false);
|
||||||
|
const maxGuesses = 6;
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="App-container">
|
||||||
<h1>hello wordl</h1>
|
<h1>hello wordl</h1>
|
||||||
<footer className="App-footer">
|
<div style={{ position: "absolute", right: 5, top: 5 }}>
|
||||||
by <a href="https://twitter.com/chordbug">@chordbug</a>, inspired by{" "}
|
<a href="#" onClick={() => setAbout((a) => !a)}>
|
||||||
<a href="https://www.powerlanguage.co.uk/wordle/">wordle</a>. report
|
{about ? "Close" : "About"}
|
||||||
issues <a href="https://github.com/lynn/hello-wordl/issues">here</a>
|
</a>
|
||||||
</footer>
|
|
||||||
<div className="App">
|
|
||||||
<Game maxGuesses={6} />
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
{about && (
|
||||||
|
<div className="App-about">
|
||||||
|
<p>
|
||||||
|
<i>hello wordl</i> is a remake of the word game{" "}
|
||||||
|
<a href="https://www.powerlanguage.co.uk/wordle/">
|
||||||
|
<i>Wordle</i>
|
||||||
|
</a>
|
||||||
|
, which I think is based on the TV show <i>Lingo</i>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
You get {maxGuesses} tries to guess a target word.
|
||||||
|
<br />
|
||||||
|
After each guess, you get Mastermind-style feedback:
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<Row
|
||||||
|
rowState={RowState.LockedIn}
|
||||||
|
wordLength={4}
|
||||||
|
cluedLetters={[
|
||||||
|
{ clue: Clue.Absent, letter: "w" },
|
||||||
|
{ clue: Clue.Absent, letter: "o" },
|
||||||
|
{ clue: Clue.Correct, letter: "r" },
|
||||||
|
{ clue: Clue.Elsewhere, letter: "d" },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b>W</b> and <b>O</b> aren't in the target word at all.
|
||||||
|
<br />
|
||||||
|
<b>R</b> is correct! The third letter is <b>R</b>
|
||||||
|
.<br />
|
||||||
|
<b>D</b> occurs <em>elsewhere</em> in the target
|
||||||
|
word.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Let's move the <b>D</b> in our next guess:
|
||||||
|
<Row
|
||||||
|
rowState={RowState.LockedIn}
|
||||||
|
wordLength={4}
|
||||||
|
cluedLetters={[
|
||||||
|
{ clue: Clue.Correct, letter: "d" },
|
||||||
|
{ clue: Clue.Correct, letter: "a" },
|
||||||
|
{ clue: Clue.Correct, letter: "r" },
|
||||||
|
{ clue: Clue.Absent, letter: "k" },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
So close!
|
||||||
|
<Row
|
||||||
|
rowState={RowState.LockedIn}
|
||||||
|
wordLength={4}
|
||||||
|
cluedLetters={[
|
||||||
|
{ clue: Clue.Correct, letter: "d" },
|
||||||
|
{ clue: Clue.Correct, letter: "a" },
|
||||||
|
{ clue: Clue.Correct, letter: "r" },
|
||||||
|
{ clue: Clue.Correct, letter: "t" },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
Got it!
|
||||||
|
</p>
|
||||||
|
Report issues <a href="https://github.com/lynn/hello-wordl/issues">here</a>, or tweet <a href="https://twitter.com/chordbug">@chordbug</a>.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<Game maxGuesses={maxGuesses} hidden={about} />
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ enum GameState {
|
|||||||
|
|
||||||
interface GameProps {
|
interface GameProps {
|
||||||
maxGuesses: number;
|
maxGuesses: number;
|
||||||
|
hidden: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const targets = common
|
const targets = common
|
||||||
@@ -120,7 +121,7 @@ function Game(props: GameProps) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="Game">
|
<div className="Game" style={{ display: props.hidden ? "none" : "block" }}>
|
||||||
<div className="Game-options">
|
<div className="Game-options">
|
||||||
<label htmlFor="wordLength">Letters:</label>
|
<label htmlFor="wordLength">Letters:</label>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ export const names: Set<string> = new Set([
|
|||||||
"carol",
|
"carol",
|
||||||
"costa",
|
"costa",
|
||||||
"dutch",
|
"dutch",
|
||||||
|
"fossa", // just too hard
|
||||||
"harry",
|
"harry",
|
||||||
"jimmy",
|
"jimmy",
|
||||||
"jones",
|
"jones",
|
||||||
@@ -13,6 +14,7 @@ export const names: Set<string> = new Set([
|
|||||||
"pedro",
|
"pedro",
|
||||||
"roger",
|
"roger",
|
||||||
"sally",
|
"sally",
|
||||||
|
"savoy",
|
||||||
"texas",
|
"texas",
|
||||||
"willy",
|
"willy",
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user