Skip to content
This repository was archived by the owner on Feb 3, 2024. It is now read-only.

Commit 32ae62a

Browse files
committed
more responsive
1 parent 339dfff commit 32ae62a

3 files changed

Lines changed: 14 additions & 19 deletions

File tree

β€Žpackages/docs/index.cssβ€Ž

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ body {
8080
margin: 0 auto;
8181
}
8282

83-
label {
84-
user-select: none;
85-
}
86-
8783
hr {
8884
border-style: solid;
8985
}
@@ -135,13 +131,7 @@ svg .text-shadow {
135131
color: var(--background);
136132
}
137133

138-
.header {
139-
display: flex;
140-
flex-direction: row;
141-
justify-content: space-between;
142-
margin-bottom: 1rem;
143-
}
144-
145-
.header h1 {
146-
margin: 0;
134+
/* We'll set this ourselves with tailwind utilities. */
135+
.prose h1 {
136+
margin: inherit !important;
147137
}

β€Žpackages/docs/index.jsβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ const toggleElements = document.querySelectorAll('.toggle')
1818
// Listen to the color mode and update the UI.
1919
mode.subscribe((v) => {
2020
toggleElements.forEach(
21-
(el) => (el.textContent = v === 'dark' ? '🌚 Dark' : '🌝 Light'),
21+
(el) =>
22+
(el.querySelector('.label').textContent =
23+
v === 'dark' ? '🌚 Dark' : '🌝 Light'),
2224
)
2325
changeFavicon(v === 'dark' ? 'moon.png' : 'sun.png')
2426
})

β€Žpackages/docs/index.pugβ€Ž

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ html
1313
style
1414
include ./index.css
1515
body.prose
16-
div.header
17-
h1 🌚🌝 Perfect Dark Mode
18-
button.toggle(style="visibility: hidden;") 🌝 color mode
16+
div.header.flex.items-center.mb-3.justify-between.flex-col(class="md:flex-row")
17+
h1(class="mb-3 md:mb-0") 🌚🌝 Perfect Dark Mode
18+
button.toggle.flex.flex-col.items-center(style="visibility: hidden;")
19+
span.label 🌝 color mode
20+
span.text-xs (Click Me)
1921

20-
div.flex.space-x-2
22+
div.flex.space-x-2.justify-center(class="md:justify-start")
2123
a.badge(href='https://www.npmjs.com/package/perfect-dark-mode' target="blank" rel="noopener")
2224
+badge("npm", version)
2325
a.badge(href='https://bundlephobia.com/result?p=perfect-dark-mode' target="blank" rel="noopener")
@@ -41,7 +43,8 @@ html
4143
// For users with JS disabled there will not be a color mode toggle, they can change
4244
// their system color mode.
4345
p You can set the color mode, this will be saved.
44-
button.toggle(style="visibility: hidden;") 🌝 color mode
46+
button.toggle(style="visibility: hidden;")
47+
span.label 🌝 color mode
4548
p You can reset the color mode and fallback to system color mode.
4649
button(id="button") Reset
4750
p For debugging and understanding here is the saved color mode and the OS color mode.

0 commit comments

Comments
Β (0)