Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ npm install
npm run dev
```

3. Acesse no navegador:
3. Em outro terminal, acompanhe o Sass e gere o CSS automaticamente:
```bash
npm run watch:styles
```

4. Acesse no navegador:
```
http://localhost:1234
```
Expand Down
15 changes: 15 additions & 0 deletions asset/images/logo.svg

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renomeia a logo para algo que fique claro que é do versus, de repente: versus-logo.svg

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions asset/javascript/ThemeController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
export function ThemeController(reference) {
const body = reference;

const themeMenuButton = body.querySelector('.js-theme-menu-button');
const themeDropdown = body.querySelector('.js-theme-dropdown');

const defaultThemeButton = body.querySelector('.js-default-theme-button');
const versusThemeButton = body.querySelector('.js-versus-theme-button');

function init() {
if (!themeMenuButton || !themeDropdown || !defaultThemeButton || !versusThemeButton) {
return;
}

bindButtons();
}

function bindButtons() {
themeMenuButton.addEventListener('click', toggleThemeMenu);
defaultThemeButton.addEventListener('click', setDefaultTheme);
versusThemeButton.addEventListener('click', setVersusTheme);
}

function toggleThemeMenu() {
themeDropdown.classList.toggle('hide');
}

function setDefaultTheme() {
body.classList.remove('versus-theme');
body.classList.remove('inverted');
closeThemeMenu();
}

function setVersusTheme() {
body.classList.add('versus-theme');
body.classList.remove('inverted');
closeThemeMenu();
}

function closeThemeMenu() {
themeDropdown.classList.add('hide');
}

init();
}
9 changes: 8 additions & 1 deletion asset/javascript/TimeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import {
secondsToHour,
secondsToMinute,
} from './TimeUtils.js';
import { ThemeController } from './ThemeController.js';

function TimerController(reference) {
const hourInput = reference.querySelector('.js-hour-input');
const minuteInput = reference.querySelector('.js-minute-input');
const secondInput = reference.querySelector('.js-seconds-input');
const themeButton = reference.querySelector('.js-theme-menu-container');

const actionButtonsContainer = reference.querySelector('.js-stopwatch-action-buttons');
const enterFullscreenButton = actionButtonsContainer.querySelector('.js-enter-fullscreen-button');
Expand Down Expand Up @@ -55,6 +57,7 @@ function TimerController(reference) {
bindButtons();
bindFullscreenEvents();
setInputValues(DEFAULT_SECONDS);
new ThemeController(reference);
}

var bindInputs = function () {
Expand Down Expand Up @@ -197,7 +200,10 @@ function TimerController(reference) {
lastTimerStatus = TimerStatus.COUNTDOWN;
playCountdownSound();

if (!preventOpenCountdown) executeCountdown(seconds);
if (!preventOpenCountdown) {
themeButton.hideElement();
executeCountdown(seconds);
}
}

setInputValues(seconds);
Expand Down Expand Up @@ -319,6 +325,7 @@ function TimerController(reference) {
stopSound.pause();
stopSound.currentTime = 0;
stopSound.volume = 0;
themeButton.showElement();
}

function toggleButtonsContainer(isEditing) {
Expand Down
Loading
Loading