Skip to content

Commit 36dd65c

Browse files
authored
Merge pull request #20 from viniciusstaiguer/main
Adição de propriedade e alteração da função
2 parents 487edfe + 30adfca commit 36dd65c

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

script.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function timer() {
5353

5454
if (seconds <= 10) {
5555
TIMER_STATUS = TimerStatus.COUNTDOWN;
56-
styleCountdown(seconds);
56+
styleBlinkCountdown(seconds);
5757
}
5858

5959
setInputValues(seconds);
@@ -188,14 +188,27 @@ const styles = {
188188
function applyStyles() {
189189
resetStyles();
190190
styles[TIMER_STATUS]?.();
191-
}
191+
};
192192

193-
function styleCountdown(seconds = 0) {
193+
function styleBlinkCountdown(seconds = 10) {
194194
document.querySelector(".input-stopwatch").classList.add("hide");
195195
document.querySelector(".js-stopwatch-button").classList.add("hide");
196196
document.getElementById("countdown").classList.remove("hide");
197197
document.getElementById("countdown-number").textContent = seconds;
198-
}
198+
199+
// Alterna a cor a cada segundo
200+
if (seconds % 2 === 0) {
201+
document.getElementById("countdown").style.backgroundColor = "#46ffbe";
202+
document.getElementById("countdown-number").style.color = "#444444";
203+
} else {
204+
document.getElementById("countdown").style.backgroundColor = "#242424";
205+
document.getElementById("countdown-number").style.color = "#46ffbe";
206+
}
207+
};
208+
209+
// function styleCountdown(seconds = 0) {
210+
211+
// }
199212

200213
function styleRunning() {
201214
document.querySelector(".js-play-button").classList.add("press-start");

style.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,13 @@ input::-webkit-inner-spin-button {
8686

8787
input[type=number] {
8888
/* ta aparecendo um warning aqui pra mim, mas não sei arrumar, talvez eu seja burro */
89-
-moz-appearance: textfield;
89+
/*
90+
Cara tu não é burro -moz-appearance é específica para Firefox
91+
Para melhorar compatibilidade adicionei duas duas propriedades
92+
*/
93+
-moz-appearance: textfield; /* Para Firefox */
94+
-webkit-appearance: none; /* Para Chrome, Safari, Edge */
95+
appearance: none; /* Padrão - navegadores mais modernos */
9096
}
9197

9298
#countdown {

0 commit comments

Comments
 (0)