forked from thesam73/wordle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
441a78c
commit 8e26ecf
Showing
11 changed files
with
2,580 additions
and
76 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,10 @@ | ||
# Getting Started with Create React App | ||
word that updates as you type within the active row | ||
once entered, you want to store the whole word in an array full of all the guesses so far. | ||
["treat", "races", "", "", "", "" ] | ||
currentRow = 0 and increments | ||
once you guess a word, the status of the letters is stored. That updates the appearance of the keyboard, and also the color of the cell in the word row. | ||
after you guess a word, the next row is "unlocked" or the active row that you are now working in. You can input letters starting at the furthest left, as the row is filled, the "active" cell moves one to the right. | ||
If you delete a letter, the cell to the left is emptied and becomes the current cell. | ||
If you hit enter before all cells are filled, it errors out | ||
If you guess a word that isn't in the words list, it errors out. | ||
|
||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). | ||
|
||
## Available Scripts | ||
|
||
In the project directory, you can run: | ||
|
||
### `npm start` | ||
|
||
Runs the app in the development mode.\ | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
The page will reload if you make edits.\ | ||
You will also see any lint errors in the console. | ||
|
||
### `npm test` | ||
|
||
Launches the test runner in the interactive watch mode.\ | ||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. | ||
|
||
### `npm run build` | ||
|
||
Builds the app for production to the `build` folder.\ | ||
It correctly bundles React in production mode and optimizes the build for the best performance. | ||
|
||
The build is minified and the filenames include the hashes.\ | ||
Your app is ready to be deployed! | ||
|
||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. | ||
|
||
### `npm run eject` | ||
|
||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!** | ||
|
||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. | ||
|
||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. | ||
|
||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. | ||
|
||
## Learn More | ||
|
||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). | ||
|
||
To learn React, check out the [React documentation](https://reactjs.org/). |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { ReactNode } from "react"; | ||
import classnames from "classnames"; | ||
import { CharStatus, CharValue } from "../../lib/keyboard"; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
value: CharValue; | ||
width?: number; | ||
status?: CharStatus; | ||
onClick: (value: CharValue) => void; | ||
}; | ||
|
||
export const Key = ({ | ||
children, | ||
status, | ||
width = 40, | ||
value, | ||
onClick, | ||
}: Props) => { | ||
const classes = classnames( | ||
"flex items-center justify-center rounded mx-0.5 text-xs font-bold cursor-pointer", | ||
{ | ||
"bg-slate-200 hover:bg-slate-300 active:bg-slate-400": !status, | ||
"bg-slate-400 text-white": status === "absent", | ||
"bg-green-500 hover:bg-green-600 active:bg-green-700 text-white": | ||
status === "correct", | ||
"bg-yellow-500 hover:bg-yellow-600 active:bg-yellow-700 text-white": | ||
status === "present", | ||
} | ||
); | ||
|
||
return ( | ||
<div | ||
style={{ width: `${width}px`, height: "58px" }} | ||
className={classes} | ||
onClick={() => onClick(value)} | ||
> | ||
<span>{children}</span> | ||
</div> | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import { CharValue } from "../../lib/keyboard"; | ||
import { Key } from "./Key"; | ||
|
||
type Props = { | ||
onChar: (value: string) => void; | ||
onDelete: () => void; | ||
onEnter: () => void; | ||
}; | ||
|
||
export const Keyboard = (props: Props) => { | ||
const onClick = (value: CharValue) => { | ||
if (value === "ENTER") { | ||
return props.onEnter(); | ||
} | ||
if (value === "DELETE") { | ||
return props.onDelete(); | ||
} | ||
return props.onChar(value); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<div className="flex justify-center mb-1"> | ||
<Key value="Q" onClick={onClick}> | ||
Q | ||
</Key> | ||
<Key value="W" onClick={onClick}> | ||
W | ||
</Key> | ||
<Key value="E" onClick={onClick}> | ||
E | ||
</Key> | ||
<Key status="correct" value="R" onClick={onClick}> | ||
R | ||
</Key> | ||
<Key value="T" onClick={onClick}> | ||
T | ||
</Key> | ||
<Key value="Y" onClick={onClick}> | ||
Y | ||
</Key> | ||
<Key status="present" value="U" onClick={onClick}> | ||
U | ||
</Key> | ||
<Key value="I" onClick={onClick}> | ||
I | ||
</Key> | ||
<Key value="O" onClick={onClick}> | ||
O | ||
</Key> | ||
<Key value="P" onClick={onClick}> | ||
P | ||
</Key> | ||
</div> | ||
<div className="flex justify-center mb-1"> | ||
<Key value="A" onClick={onClick}> | ||
A | ||
</Key> | ||
<Key value="S" onClick={onClick}> | ||
S | ||
</Key> | ||
<Key value="D" onClick={onClick}> | ||
D | ||
</Key> | ||
<Key status="present" value="F" onClick={onClick}> | ||
F | ||
</Key> | ||
<Key value="G" onClick={onClick}> | ||
G | ||
</Key> | ||
<Key value="H" onClick={onClick}> | ||
H | ||
</Key> | ||
<Key value="J" onClick={onClick}> | ||
J | ||
</Key> | ||
<Key status="absent" value="K" onClick={onClick}> | ||
K | ||
</Key> | ||
<Key value="L" onClick={onClick}> | ||
L | ||
</Key> | ||
</div> | ||
<div className="flex justify-center"> | ||
<Key width={65.4} value="ENTER" onClick={onClick}> | ||
ENTER | ||
</Key> | ||
<Key value="Z" onClick={onClick}> | ||
Z | ||
</Key> | ||
<Key value="X" onClick={onClick}> | ||
X | ||
</Key> | ||
<Key value="C" onClick={onClick}> | ||
C | ||
</Key> | ||
<Key value="V" onClick={onClick}> | ||
V | ||
</Key> | ||
<Key value="B" onClick={onClick}> | ||
B | ||
</Key> | ||
<Key value="N" onClick={onClick}> | ||
N | ||
</Key> | ||
<Key value="M" onClick={onClick}> | ||
M | ||
</Key> | ||
<Key width={65.4} value="DELETE" onClick={onClick}> | ||
DELETE | ||
</Key> | ||
</div> | ||
</div> | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
body { | ||
margin: 0; | ||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', | ||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', | ||
sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
code { | ||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', | ||
monospace; | ||
} | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export type CharStatus = "absent" | "present" | "correct"; | ||
|
||
export type CharValue = | ||
| "Q" | ||
| "W" | ||
| "E" | ||
| "R" | ||
| "T" | ||
| "Y" | ||
| "U" | ||
| "I" | ||
| "O" | ||
| "P" | ||
| "A" | ||
| "S" | ||
| "D" | ||
| "F" | ||
| "G" | ||
| "H" | ||
| "J" | ||
| "K" | ||
| "L" | ||
| "ENTER" | ||
| "Z" | ||
| "X" | ||
| "C" | ||
| "V" | ||
| "B" | ||
| "N" | ||
| "M" | ||
| "DELETE"; |
Oops, something went wrong.