-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
49 lines (35 loc) · 1.54 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const html = document.querySelector("html");
const btnTheme = document.querySelector(".js-button-theme");
const btnsProjects = document.querySelectorAll(".projects__button");
const projects = document.querySelectorAll(".js-projects");
const warningProject = document.querySelector(".js-project-warning");
const descriptionsProjects = [
" A Rocketseat é uma escola de programação e todos os projeto aqui foram desenvolvidos em eventos e desafio como o #boraCodar ",
"ONE é um programa de capacitação na área de TI da Oracle + Alura e todos os projeto aqui foram desenvolvidos na Turma 5 do ONE",
"Aqui estão todos os projeto que eu fiz sozinho com os conhecimetos adquiridos em cursos online, eventos, desafios e estudo autodidata",
];
function toggleTheme() {
html.classList.toggle("theme-dark");
btnTheme.src = "./assets/image/sun.svg";
if(html.classList.contains("theme-dark")) {
btnTheme.src = "./assets/image/moon.svg";
}
}
function showProject(index) {
for(project of projects) {
project.classList.remove("is-visible");
}
projects[index].classList.add("is-visible");
warningProject.textContent = descriptionsProjects[index];
}
function selectButton(index) {
for(button of btnsProjects) {
button.classList.remove("is-selected");
}
btnsProjects[index].classList.add("is-selected");
showProject(index);
}
btnsProjects.forEach((button, index ) => {
button.addEventListener("click", () => selectButton(index));
})
btnTheme.addEventListener("click", toggleTheme);