Skip to content

Commit 70800f1

Browse files
committed
any animation to owl when guess is correct
1 parent 52bc0df commit 70800f1

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

client/src/App.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
font-family: "Passero One";
1010
font-weight: bolder;
1111
font-size: 1.8em;
12-
padding-top: 4vh;
12+
padding-top: 20px;
1313
color: light-dark(#333, #ddd);
1414
}
1515

@@ -159,7 +159,6 @@ p {
159159
#score {
160160
color: #888;
161161
font-size: 0.8em;
162-
height: 5vh;
163162
}
164163

165164
button {

client/src/App.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { get_random_term } from "./main.ts";
88

99
import "animate.css";
1010

11-
1211
function MyConfetti( { confetti } ) {
1312
const { width, height } = useWindowSize();
1413
if (!confetti)
@@ -20,8 +19,6 @@ function MyConfetti( { confetti } ) {
2019
</>
2120
}
2221

23-
24-
2522
function Square( { letter, colors, onSquareClick } ) {
2623
let color = letter.length > 0 && colors != null ? colors[letter.charCodeAt(0) - "A".charCodeAt(0)] : "";
2724
return <button key={letter} className={`square ${color}`} onClick={onSquareClick}>{letter}</ button>;
@@ -52,10 +49,12 @@ function Word( { attempt, success, revealed } ) {
5249
</>
5350
}
5451

55-
function Logo() {
52+
function Logo( { success } ) {
53+
const animation = success ? "animate__animated animate__shakeY" : "animate__animated animate__fadeIn";
54+
5655
return <>
5756
<div id="logo">
58-
<h1><img src="./owl.png" className="animate__animated animate__swing"></img> erudite</h1>
57+
<h1><img src="./owl.png" key={ success.toString() } className={ animation }></img> erudite</h1>
5958
</div>
6059
</>
6160
}
@@ -250,7 +249,7 @@ function App() {
250249
<div>
251250
<MyConfetti confetti={ confetti } />
252251
<Credits />
253-
<Logo />
252+
<Logo success={ success } />
254253
<Definition term={ term } />
255254
<Status status={ status } />
256255
<WordContainer attempt={ attempt } success={ success } status={ status } revealed={ revealed } />

0 commit comments

Comments
 (0)