Skip to content
Open
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions asset/javascript/ThemeController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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() {
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();
}

document.addEventListener('DOMContentLoaded', function () {
const reference = document.querySelector('.js-body');
const themeController = new ThemeController(reference);
window.themeController = themeController;
});

export default ThemeController;
Loading
Loading