-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1a13bec
Showing
17 changed files
with
450 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,83 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br" data-contexto="foco"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Fokus</title> | ||
<link rel="shortcut icon" href="./imagens/favicon.ico" type="image/x-icon"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css" | ||
integrity="sha512-NmLkDIU1C/C88wi324HBc+S2kLhi08PN5GDeUVVVC/BVt/9Izdsc9SVeVfA1UZbY3sHUlDSyRXhCzHfr6hmPPw==" | ||
crossorigin="anonymous" referrerpolicy="no-referrer" /> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Prata&family=Unbounded:wght@200;300;400;500;600;700;800;900&display=swap" | ||
rel="stylesheet"> | ||
<link rel="stylesheet" href="./styles.css"> | ||
</head> | ||
|
||
<body> | ||
<main class="app"> | ||
<header class="app__header"> | ||
<figure class="app__logo-figure"> | ||
<img class="app__logo-image" src="/imagens/logo.png" alt=""> | ||
</figure> | ||
</header> | ||
<section class="app__section-banner-container"> | ||
<h1 class="app__title"> | ||
Otimize sua produtividade,<br> | ||
<strong class="app__title-strong">mergulhe no que importa.</strong> | ||
</h1> | ||
<figure class="app__image-figure"> | ||
<img class="app__image" src="/imagens/foco.png" alt=""> | ||
</figure> | ||
</section> | ||
<section class="app__section-card-container"> | ||
<div class="app__card"> | ||
<ul class="app__card-list"> | ||
<li class="app__card-list-item"> | ||
<button data-contexto="foco" class="app__card-button app__card-button--foco active">Foco</button> | ||
</li> | ||
<li class="app__card-list-item"> | ||
<button data-contexto="short" class="app__card-button app__card-button--curto">Descanso curto</button> | ||
</li> | ||
<li class="app__card-list-item"> | ||
<button data-contexto="long" class="app__card-button app__card-button--longo">Descanso longo</button> | ||
</li> | ||
</ul> | ||
<div id="timer" class="app__card-timer"></div> | ||
<ul class="app__card-list"> | ||
<li class="app__card-list-item"> | ||
<label class="toggle"> | ||
<input class="toggle-checkbox" type="checkbox" id="alternar-musica"> | ||
<div class="toggle-switch"></div> | ||
</label> | ||
</li> | ||
<li class="app__card-list-item"> | ||
<label class="app__card-list-label" for="alternar-musica"> | ||
Música | ||
</label> | ||
</li> | ||
</ul> | ||
<div class="app__card-primary-button-wrapper"> | ||
<button id="start-pause" class="app__card-primary-button"> | ||
<img class="app__card-primary-butto-icon" src="/imagens/play_arrow.png" alt=""> | ||
<span>Começar</span> | ||
</button> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<footer class="app__footer"> | ||
<p class="app__footer-text"> | ||
Desenvolvido por Amanda. Projeto fictício da Formação ONE Oracle Next Education + Alura. Imagens geradas por IA no Adobe Firefly. | ||
</p> | ||
</footer> | ||
</main> | ||
|
||
<script src="/script.js"></script> | ||
|
||
</body> | ||
|
||
</html> |
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,115 @@ | ||
const html = document.querySelector('html') | ||
const focoBtn = document.querySelector('.app__card-button--foco') | ||
const curtBtn = document.querySelector('.app__card-button--curto') | ||
const longoBtn = document.querySelector('.app__card-button--longo') | ||
const banner = document.querySelector('.app__image') | ||
const titulo = document.querySelector('.app__title') | ||
const botoes = document.querySelectorAll('.app__card-button') | ||
const startPausedBt = document.querySelector('#start-pause') | ||
const musicaFocoInput = document.querySelector('#alternar-musica') | ||
const iniciarOuPausarBt = document.querySelector('#start-pause span') | ||
const iniciarOuPausarBtIcone = document.querySelector(".app__card-primary-butto-icon") | ||
const tempoNaTela = document.querySelector('#timer') | ||
|
||
const musica = new Audio('/sons/luna-rise-part-one.mp3') | ||
const audioPlay = new Audio('/sons/play.wav'); | ||
const audioPausa = new Audio('/sons/pause.mp3'); | ||
const audioTempoFinalizado = new Audio('./sons/beep.mp3') | ||
|
||
let tempoDecorridoEmSegundos = 1500 | ||
let intervaloId = null | ||
|
||
musica.loop = true | ||
|
||
musicaFocoInput.addEventListener('change', () => { | ||
if(musica.paused) { | ||
musica.play() | ||
} else { | ||
musica.pause() | ||
} | ||
}) | ||
|
||
focoBtn.addEventListener('click', () => { | ||
tempoDecorridoEmSegundos = 1500 | ||
alterarContexto('foco') | ||
focoBtn.classList.add('active') | ||
}) | ||
|
||
curtBtn.addEventListener('click', () => { | ||
tempoDecorridoEmSegundos = 300 | ||
alterarContexto('descanso-curto') | ||
curtBtn.classList.add('active') | ||
}) | ||
|
||
longoBtn.addEventListener('click', () => { | ||
tempoDecorridoEmSegundos = 900 | ||
alterarContexto('descanso-longo') | ||
longoBtn.classList.add('active') | ||
}) | ||
|
||
function alterarContexto(contexto) { | ||
mostrarTempo() | ||
botoes.forEach(function(contexto) { | ||
contexto.classList.remove('active') | ||
}) | ||
html.setAttribute('data-contexto', contexto) | ||
banner.setAttribute('src', `/imagens/${contexto}.png`) | ||
switch (contexto) { | ||
case "foco": | ||
titulo.innerHTML = `Otimize sua produtividade,<br> | ||
<strong class="app__title-strong">mergulhe no que importa.</strong>` | ||
break; | ||
case "descanso-curto": | ||
titulo.innerHTML = `Que tal dar uma respirada?<br> | ||
<strong class="app__title-strong">Faça uma pausa curta!</strong>` | ||
break; | ||
|
||
case "descanso-longo": | ||
titulo.innerHTML = `Hora de voltar à superfície.<br> | ||
<strong class="app__title-strong">Faça uma pausa longa.</strong>` | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
} | ||
|
||
const contagemRegrssiva = () =>{ | ||
if(tempoDecorridoEmSegundos <= 0) { | ||
audioTempoFinalizado.play() | ||
alert('Tempo finalizado!') | ||
zerar() | ||
return | ||
} | ||
tempoDecorridoEmSegundos -= 1 | ||
mostrarTempo() | ||
} | ||
|
||
startPausedBt.addEventListener('click', iniciarOuPausar) | ||
|
||
function iniciarOuPausar() { | ||
if(intervaloId) { | ||
audioPausa.play() | ||
zerar() | ||
return | ||
} | ||
audioPlay.play() | ||
intervaloId = setInterval(contagemRegrssiva, 1000) | ||
iniciarOuPausarBt.textContent = "Pausar" | ||
iniciarOuPausarBtIcone.setAttribute('src', `/imagens/pause.png`) | ||
} | ||
|
||
function zerar() { | ||
clearInterval(intervaloId) | ||
iniciarOuPausarBt.textContent = "Começar" | ||
iniciarOuPausarBtIcone.setAttribute('src', `/imagens/play_arrow.png`) | ||
intervaloId = null | ||
} | ||
|
||
function mostrarTempo() { | ||
const tempo = new Date(tempoDecorridoEmSegundos * 1000) | ||
const tempoFormatado = tempo.toLocaleTimeString('pt-br', {minute: '2-digit', second: '2-digit'}) | ||
tempoNaTela.innerHTML = `${tempoFormatado}` | ||
} | ||
|
||
mostrarTempo() |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.