Skip to content

Commit cb1d0b3

Browse files
committed
reafctor: semantic html
1 parent 1dd8d4c commit cb1d0b3

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

019-theme clock/index.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
</head>
99
<body>
1010
<button class="toggle">Dark mode</button>
11-
<div class="clock-container">
12-
<div class="clock">
13-
<div class="needle hour"></div>
14-
<div class="needle minute"></div>
15-
<div class="needle second"></div>
16-
<div class="center-point"></div>
17-
</div>
18-
<div class="time"></div>
11+
<section class="clock-container">
12+
<figure class="clock" aria-label="Analog clock">
13+
<span class="needle hour"></span>
14+
<span class="needle minute"></span>
15+
<span class="needle second"></span>
16+
<span class="center-point"></span>
17+
</figure>
18+
<time class="time" aria-live="polite"></time>
1919
<div class="date"></div>
20-
</div>
20+
</section>
2121
<script src="script.js"></script>
2222
</body>
2323
</html>

019-theme clock/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const secondElement = document.querySelector(".second");
44
const timeElement = document.querySelector(".time");
55
const dateElement = document.querySelector(".date");
66
const toggle = document.querySelector(".toggle");
7+
const html = document.querySelector("html");
78

89
const days = [
910
"Sunday",
@@ -30,7 +31,6 @@ const months = [
3031
];
3132

3233
toggle.addEventListener("click", (e) => {
33-
const html = document.querySelector("html");
3434
if (html.classList.contains("dark")) {
3535
html.classList.remove("dark");
3636
e.target.innerHTML = "Dark mode";

019-theme clock/style.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ html {
1616
html.dark {
1717
--primary-color: #fff;
1818
--secondary-color: #333;
19-
}
20-
21-
html.dark {
2219
background-color: #111;
2320
color: var(--primary-color);
2421
}

0 commit comments

Comments
 (0)