Skip to content

Commit

Permalink
better cosmetics and favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
LooLzzz committed Aug 30, 2024
1 parent 25a6ac8 commit 6b555e8
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 64 deletions.
56 changes: 13 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,20 @@
# React + TypeScript + Vite
# Better Wordle

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
## Description

Currently, two official plugins are available:
This is an implementation of the popular word-guessing game Wordle with my own twist.

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
## Objective

## Expanding the ESLint configuration
Wordle is a popular word-guessing game where players try to guess a hidden word by making guesses and receiving feedback on their guesses.
The game provides clues in the form of colored squares, indicating whether a guessed letter is correct and in the correct position (usually marked with a green square) or correct but in the wrong position (usually marked with a yellow square).
The objective is to guess the word within a limited number of attempts.

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
## Features

- Configure the top-level `parserOptions` property like this:
All the normal Wordle features and rules are present, with the following additional features:

```js
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
import react from 'eslint-plugin-react'

export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})
```
- Clicking on a box will highlight it and pressing a key will fill the highlighted box with the corresponding letter.
- Pressing the Backspace key will clear the highlighted box.
- Pressing left or right arrow keys will move the highlight left or right.
- Pressing the Escape key will clear the selection.
7 changes: 5 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Better Wordle</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
</html>
Binary file added public/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon.ico
Binary file not shown.
19 changes: 19 additions & 0 deletions public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "",
"short_name": "",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#FFFFFF",
"background_color": "#FFFFFF",
"display": "standalone"
}
7 changes: 6 additions & 1 deletion src/assets/backspace.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/enter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-ignore
export { default as BackspaceIcon } from './backspace.svg?react'
// @ts-ignore
export { default as LoginIcon } from './login.svg?react'
export { default as EnterIcon } from './enter.svg?react'

import answerList from './answerlist.json'
import wordList from './wordlist.json'
Expand Down
1 change: 0 additions & 1 deletion src/assets/login.svg

This file was deleted.

12 changes: 12 additions & 0 deletions src/assets/wordle-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions src/components/FloatingKeyboard/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
padding: 0rem 0.5rem !important;
}

&:hover {
background-color: var(--mantine-color-default-hover);
@media screen and (min-width: 768px) {
&:hover {
background-color: var(--mantine-color-default-hover);
}
}

&:active,
Expand Down
4 changes: 2 additions & 2 deletions src/components/FloatingKeyboard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Group, Kbd, Stack } from '@mantine/core'
import { useEffect, useMemo, useRef } from 'react'

import { BackspaceIcon, LoginIcon as EnterIcon } from '@/assets'
import { BackspaceIcon, EnterIcon } from '@/assets'
import { useWordleStore } from '@/hooks'

import classes from './index.module.scss'
Expand Down Expand Up @@ -121,7 +121,7 @@ const FloatingKeyboard = () => {
key === 'Backspace'
? <BackspaceIcon style={{ transform: 'translateY(0.25rem)' }} />
: key === 'Enter'
? <EnterIcon style={{ transform: 'translateY(0.25rem)' }} />
? <EnterIcon style={{ transform: 'translateY(0.3rem)' }} />
: key
}
</Kbd>
Expand Down
17 changes: 6 additions & 11 deletions src/components/WordsGuesser/Guess/index.module.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
$reveal-anim-duration-sec: 0.35;
$reveal-anim-duration: #{$reveal-anim-duration-sec}s;
$reveal-anim-duration-ms: 350;
$reveal-anim-duration: #{$reveal-anim-duration-ms}ms;
$reveal-anim-timing-function: ease;

@keyframes reveal-anim {
// 0% {
// transform: scaleY(1);
// }

0% {
transform: scaleY(0);
}
Expand All @@ -16,11 +12,10 @@ $reveal-anim-timing-function: ease;
}
}


@for $i from 1 through 10 {
@for $i from 1 through 6 {
.lettersContainer .reveal:nth-child(#{$i}n) {
animation-delay: #{($i - 1) * $reveal-anim-duration-sec}s;
transition-delay: #{($i - 1) * $reveal-anim-duration-sec}s;
animation-delay: #{($i - 1) * $reveal-anim-duration-ms}ms;
transition-delay: #{($i - 1) * $reveal-anim-duration-ms}ms;
}
}

Expand All @@ -29,6 +24,7 @@ $reveal-anim-timing-function: ease;
height: 5rem;
border: 1px solid var(--mantine-color-default-border);
text-transform: uppercase;
transition: background-color 150ms;

@media screen and (max-width: 768px) {
width: 3.5rem;
Expand All @@ -50,7 +46,6 @@ $reveal-anim-timing-function: ease;

.reveal {
animation: reveal-anim $reveal-anim-duration;
transition: background-color $reveal-anim-duration;
animation-iteration-count: 1;
animation-timing-function: $reveal-anim-timing-function;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ createRoot(document.getElementById('root')!).render(
>
<Notifications
position='top-center'
autoClose={2000}
autoClose={3000}
limit={2}
/>
<App />
Expand Down

0 comments on commit 6b555e8

Please sign in to comment.