Add a clear leaderboard button in leaderboard component

This commit is contained in:
2024-02-18 21:22:10 +01:00
parent 21d5f64c06
commit c9123a2da1
3 changed files with 55 additions and 4 deletions
+35
View File
@@ -0,0 +1,35 @@
const Trash = (props: any) => {
return (
<svg
xmlns='http://www.w3.org/2000/svg'
viewBox='0 0 512 512'
{...props}
>
<path
d='M112 112l20 320c.95 18.49 14.4 32 32 32h184c17.67 0 30.87-13.51 32-32l20-320'
fill='none'
stroke='currentColor'
strokeLinecap='round'
strokeLinejoin='round'
strokeWidth='32'
/>
<path
stroke='currentColor'
strokeLinecap='round'
strokeMiterlimit='10'
strokeWidth='32'
d='M80 112h352'
/>
<path
d='M192 112V72h0a23.93 23.93 0 0124-24h80a23.93 23.93 0 0124 24h0v40M256 176v224M184 176l8 224M328 176l-8 224'
fill='none'
stroke='currentColor'
strokeLinecap='round'
strokeLinejoin='round'
strokeWidth='32'
/>
</svg>
);
};
export default Trash;
@@ -21,6 +21,7 @@ import CalendarIcon from '../../assets/calendar';
import Replay from '../../assets/replay'; import Replay from '../../assets/replay';
import Settings from '../../assets/settings'; import Settings from '../../assets/settings';
import TimerIcon from '../../assets/timer'; import TimerIcon from '../../assets/timer';
import Trash from '../../assets/trash';
import './styles.scss'; import './styles.scss';
// --------------------------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------------------------
@@ -90,6 +91,17 @@ const LeaderBoard = () => {
Paramètres Paramètres
</button> </button>
<button
className='controlButton clear'
onClick={() => {
setGameState((prev) => ({ ...prev, status: 'settings', endType: '', placedFlags: 0, bombs: 0, gameTime: '' }));
store.setItem('leaderboard', []);
}}
>
<Trash />
Supprimer
</button>
<button <button
className='controlButton replay' className='controlButton replay'
onClick={() => setGameState((prev) => ({ ...prev, status: 'idle', endType: '', placedFlags: 0, bombs: 0, gameTime: '' }))} onClick={() => setGameState((prev) => ({ ...prev, status: 'idle', endType: '', placedFlags: 0, bombs: 0, gameTime: '' }))}
+8 -4
View File
@@ -9,7 +9,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 95svw; width: 95svw;
max-width: 450px; max-width: 500px;
border-radius: 5px; border-radius: 5px;
background-color: #fff; background-color: #fff;
overflow: hidden; overflow: hidden;
@@ -73,8 +73,8 @@
.controls { .controls {
display: grid; display: grid;
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(3, 1fr);
gap: 100px; gap: 10px;
width: 100%; width: 100%;
& > .controlButton { & > .controlButton {
@@ -83,7 +83,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
gap: 10px; gap: 10px;
padding: 10px 20px; padding: 10px;
border: none; border: none;
border-radius: 5px; border-radius: 5px;
font-size: 16px; font-size: 16px;
@@ -97,6 +97,10 @@
} }
&.home { &.home {
background-color: #f39440;
}
&.clear {
background-color: #ca5940; background-color: #ca5940;
} }