Skip to content

Commit df89afb

Browse files
committed
integração jscript
1 parent 571e16c commit df89afb

5 files changed

Lines changed: 252 additions & 9 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
function ThemeController(reference) {
2+
const body = reference;
3+
4+
const themeMenuButton = body.querySelector('.js-theme-menu-button');
5+
const themeDropdown = body.querySelector('.js-theme-dropdown');
6+
7+
const defaultThemeButton = body.querySelector('.js-default-theme-button');
8+
const versusThemeButton = body.querySelector('.js-versus-theme-button');
9+
10+
function init() {
11+
bindButtons();
12+
}
13+
14+
function bindButtons() {
15+
themeMenuButton.addEventListener('click', toggleThemeMenu);
16+
defaultThemeButton.addEventListener('click', setDefaultTheme);
17+
versusThemeButton.addEventListener('click', setVersusTheme);
18+
}
19+
20+
function toggleThemeMenu() {
21+
themeDropdown.classList.toggle('hide');
22+
}
23+
24+
function setDefaultTheme() {
25+
body.classList.remove('versus-theme');
26+
body.classList.remove('inverted');
27+
closeThemeMenu();
28+
}
29+
30+
function setVersusTheme() {
31+
body.classList.add('versus-theme');
32+
body.classList.remove('inverted');
33+
closeThemeMenu();
34+
}
35+
36+
function closeThemeMenu() {
37+
themeDropdown.classList.add('hide');
38+
}
39+
40+
init();
41+
}
42+
43+
document.addEventListener('DOMContentLoaded', function () {
44+
const reference = document.querySelector('.js-body');
45+
const themeController = new ThemeController(reference);
46+
window.themeController = themeController;
47+
});
48+
49+
export default ThemeController;

‎asset/style/timer.css‎

Lines changed: 83 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎asset/style/timer.css.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎asset/style/timer.scss‎

Lines changed: 102 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88
--button-background-color: #242424;
99
--button-icon-filter: inherit;
1010
--button-border: 1px solid #fff;
11+
--primary-dark-color: #1ea97a;
1112
}
1213

1314
.versus-theme {
1415
--primary-bg-color: #ED5026;
1516
--primary-text-color: #FFFFFF;
1617
--secondary-bg-color: #000000;
1718
--secondary-text-color: #444444;
18-
--button-background-color: #FFFFFF;
19-
--button-icon-filter: brightness(0);
20-
--button-border: none;
19+
--button-background-color: transparent;
20+
--button-icon-filter: brightness(100);
21+
--button-border: 1px solid #fff;
2122
}
2223

2324

@@ -156,7 +157,7 @@ html {
156157

157158
img {
158159
max-width: 20px;
159-
max-height: 1020px;
160+
max-height: 20px;
160161
display: block;
161162

162163
filter: var(--button-icon-filter);
@@ -190,3 +191,100 @@ html {
190191
width: 380px;
191192
margin-bottom: 20px;
192193
}
194+
195+
.theme-menu-container {
196+
position: fixed;
197+
bottom: 32px;
198+
right: 32px;
199+
z-index: 10;
200+
}
201+
202+
.theme-menu-button {
203+
width: 48px;
204+
height: 48px;
205+
206+
display: flex;
207+
align-items: center;
208+
justify-content: center;
209+
210+
border-radius: 99px;
211+
border: var(--button-border);
212+
213+
cursor: pointer;
214+
215+
font-size: 28px;
216+
line-height: 1;
217+
218+
background: transparent;
219+
color: var(--primary-text-color);
220+
221+
transition: all 0.3s ease;
222+
223+
&:hover {
224+
transform: scale(1.05);
225+
background-color: rgba(255, 255, 255, 0.1);
226+
}
227+
228+
&:focus,
229+
&:focus-visible {
230+
outline: none;
231+
}
232+
}
233+
234+
.theme-dropdown {
235+
position: absolute;
236+
bottom: 60px;
237+
right: 0;
238+
239+
display: flex;
240+
flex-direction: column;
241+
gap: 8px;
242+
243+
padding: 12px;
244+
245+
background: rgba(255,255,255,0.08);
246+
backdrop-filter: blur(10px);
247+
border-radius: 16px;
248+
249+
min-width: 180px;
250+
251+
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
252+
253+
button {
254+
border: none;
255+
background: transparent;
256+
257+
padding: 12px;
258+
border-radius: 8px;
259+
260+
cursor: pointer;
261+
262+
color: white;
263+
font-size: 14px;
264+
text-align: left;
265+
266+
transition: all 0.3s ease;
267+
268+
&:hover {
269+
background: rgba(255,255,255,0.1);
270+
}
271+
}
272+
}
273+
274+
.versus-theme .countdown-container .action-button-container button {
275+
background: #ED5026;
276+
border: 1px solid #ffff;
277+
}
278+
279+
.versus-theme .countdown-container .action-button-container button img {
280+
filter: brightness(100);
281+
}
282+
.versus-theme.inverted .theme-menu-button {
283+
color: #ED5026;
284+
border: 1px solid #ED5026;
285+
}
286+
287+
body.inverted .theme-menu-button {
288+
color: #242424;
289+
border: 1px solid #242424;
290+
}

‎index.html‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,22 @@
2323
<input type="number" min="00" disabled class="js-seconds-input" />
2424
</div>
2525

26+
<div class="theme-menu-container">
27+
<button class="theme-menu-button js-theme-menu-button">
28+
⋮
29+
</button>
30+
31+
<div class="theme-dropdown js-theme-dropdown hide">
32+
<button class="js-default-theme-button">
33+
Standard Theme
34+
</button>
35+
36+
<button class="js-versus-theme-button">
37+
Versus Theme
38+
</button>
39+
</div>
40+
</div>
41+
2642
<div class="action-button-container js-stopwatch-action-buttons">
2743
<button class="js-enter-fullscreen-button">
2844
<img src="./asset/images/full-screen.svg" alt="Colocar em tela cheia" />
@@ -62,6 +78,7 @@
6278
</div>
6379
</div>
6480
<script type="module" src="./asset/javascript/TimeController.js"></script>
81+
<script type="module" src="./asset/javascript/ThemeController.js"></script>
6582
</body>
6683

6784
</html>

0 commit comments

Comments
 (0)