-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#24 Refonte de nombreux éléments en CSS + ajout d'images
#27 Refonte intégrale concernant les noms de fichiers, séparation des fichiers en CSS, etc. Ajout de la fonctionnalité pour le code couleur du monde "impossible"
- Loading branch information
1 parent
149e57f
commit 64f6911
Showing
15 changed files
with
247 additions
and
148 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
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,24 @@ | ||
import React from 'react' | ||
import '../home/styles/App.css' | ||
import heartImage from '../resources/images/new_heart.png' | ||
import { useLocation } from 'react-router-dom' | ||
|
||
export default function HealthTry () { | ||
const hearts: string[] = [] | ||
const location = useLocation() | ||
const locationState = location.state | ||
|
||
for (let i = 0; i < locationState.attempts; i++) { | ||
hearts.push(heartImage) | ||
} | ||
|
||
return ( | ||
<div className='heart-container'> | ||
{ | ||
hearts.map((heart, index) => | ||
<img key={index} src={heart} alt='heart'/> | ||
) | ||
} | ||
</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
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 |
---|---|---|
@@ -1,64 +1,29 @@ | ||
import React from 'react' | ||
import './App.css' | ||
import easy from '../resources/images/black_swan.png' | ||
import medium from '../resources/images/jingliu.png' | ||
import hard from '../resources/images/sparkle.png' | ||
import impossible from '../resources/images/ruan_mei.png' | ||
import { useNavigate } from 'react-router-dom' | ||
import React, { useState } from 'react' | ||
import './styles/App.css' | ||
import heartImage from '../resources/images/heart.png' | ||
|
||
export default function App () { | ||
const navigate = useNavigate() | ||
const hearts: string[] = [] | ||
const [numHearts, setNumHearts] = useState(9) | ||
|
||
interface FormData { | ||
difficulty: string | ||
tip: number | ||
attempts: number | ||
color: boolean | ||
for (let i = 0; i < numHearts; i++) { | ||
hearts.push(heartImage) | ||
} | ||
|
||
const handleRequest = (formData: FormData) => { | ||
navigate('/motus/game', { state: formData }) | ||
const handleClick = () => { | ||
setNumHearts(numHearts - 1) | ||
} | ||
|
||
return ( | ||
<div className="container"> | ||
<h1>Bienvenue sur Motus</h1> | ||
<p>Le jeu de mots où il faut deviner un mot en un minimum d’essais !</p> | ||
<div className="difficulty-container"> | ||
<img onClick={() => { | ||
handleRequest({ | ||
difficulty: 'Facile', | ||
tip: 1, | ||
attempts: 10, | ||
color: true | ||
}) | ||
}} src={easy} alt="easy" width="300"/> | ||
<img onClick={() => { | ||
handleRequest({ | ||
difficulty: 'Moyen', | ||
tip: 1, | ||
attempts: 7, | ||
color: true | ||
}) | ||
}} src={medium} alt="medium" width="300"/> | ||
<img onClick={() => { | ||
handleRequest({ | ||
difficulty: 'Difficile', | ||
tip: 1, | ||
attempts: 5, | ||
color: true | ||
}) | ||
}} src={hard} alt="hard" width="300"/> | ||
<img onClick={() => { | ||
handleRequest({ | ||
difficulty: 'Impossible', | ||
tip: 1, | ||
attempts: 3, | ||
color: false | ||
}) | ||
}} src={impossible} alt="impossible" width="300"/> | ||
<div className='container'> | ||
<div className='heart-container'> | ||
{ | ||
hearts.map((heart, index) => | ||
<img key={index} src={heart} alt='heart'/> | ||
) | ||
} | ||
<button onClick={handleClick}>Essai</button> | ||
</div> | ||
<button className="play-button">Jouer</button> | ||
</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,64 @@ | ||
import React from 'react' | ||
import './styles/Difficulty.css' | ||
import easy from '../resources/images/black_swan.png' | ||
import medium from '../resources/images/jingliu.png' | ||
import hard from '../resources/images/sparkle.png' | ||
import impossible from '../resources/images/ruan_mei.png' | ||
import { useNavigate } from 'react-router-dom' | ||
|
||
export default function Difficulty () { | ||
const navigate = useNavigate() | ||
|
||
interface FormData { | ||
difficulty: string | ||
tip: number | ||
attempts: number | ||
color: boolean | ||
} | ||
|
||
const handleRequest = (formData: FormData) => { | ||
navigate('/motus/game', { state: formData }) | ||
} | ||
|
||
return ( | ||
<div className="container"> | ||
<h1>Bienvenue sur Motus</h1> | ||
<p>Le jeu de mots où il faut deviner un mot en un minimum d’essais !</p> | ||
<div className="difficulty-container"> | ||
<img onClick={() => { | ||
handleRequest({ | ||
difficulty: 'Facile', | ||
tip: 1, | ||
attempts: 10, | ||
color: true | ||
}) | ||
}} src={easy} alt="easy" width="300"/> | ||
<img onClick={() => { | ||
handleRequest({ | ||
difficulty: 'Moyen', | ||
tip: 1, | ||
attempts: 7, | ||
color: true | ||
}) | ||
}} src={medium} alt="medium" width="300"/> | ||
<img onClick={() => { | ||
handleRequest({ | ||
difficulty: 'Difficile', | ||
tip: 1, | ||
attempts: 5, | ||
color: true | ||
}) | ||
}} src={hard} alt="hard" width="300"/> | ||
<img onClick={() => { | ||
handleRequest({ | ||
difficulty: 'Impossible', | ||
tip: 1, | ||
attempts: 3, | ||
color: false | ||
}) | ||
}} src={impossible} alt="impossible" width="300"/> | ||
</div> | ||
<button className="play-button">Jouer</button> | ||
</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
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,16 @@ | ||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
min-height: 100vh; | ||
width: 100%; | ||
} | ||
|
||
.input { | ||
background-image: url('../../resources/images/retry-bg.png'); | ||
border-radius: 20px; | ||
border: 3px solid #30363d; | ||
height: 80px; | ||
width: 90%; | ||
} |
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
Oops, something went wrong.