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

Commit e1d7aaa

Browse files
committed
polyfill apple emoji
1 parent 32ae62a commit e1d7aaa

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,12 @@ svg .text-shadow {
135135
.prose h1 {
136136
margin: inherit !important;
137137
}
138+
139+
.emoji {
140+
display: inline;
141+
height: 1em;
142+
width: 1em;
143+
margin: 0 !important;
144+
margin-top: -0.2em !important;
145+
vertical-align: middle;
146+
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ const toggleElements = document.querySelectorAll('.toggle')
1919
mode.subscribe((v) => {
2020
toggleElements.forEach(
2121
(el) =>
22-
(el.querySelector('.label').textContent =
23-
v === 'dark' ? '🌚 Dark' : '🌝 Light'),
22+
(el.querySelector('.label').innerHTML =
23+
v === 'dark'
24+
? '<img class="emoji" src="moon.png"> Dark'
25+
: '<img class="emoji" src="sun.png"> Light'),
2426
)
2527
changeFavicon(v === 'dark' ? 'moon.png' : 'sun.png')
2628
})

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ html
1414
include ./index.css
1515
body.prose
1616
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
17+
h1(class="mb-3 md:mb-0") <img class="emoji" src="moon.png"><img class="emoji" src="sun.png"> Perfect Dark Mode
1818
button.toggle.flex.flex-col.items-center(style="visibility: hidden;")
19-
span.label 🌝 color mode
19+
span.label <img class="emoji" src="sun.png"> color mode
2020
span.text-xs (Click Me)
2121

2222
div.flex.space-x-2.justify-center(class="md:justify-start")
@@ -44,7 +44,7 @@ html
4444
// their system color mode.
4545
p You can set the color mode, this will be saved.
4646
button.toggle(style="visibility: hidden;")
47-
span.label 🌝 color mode
47+
span.label <img class="emoji" src="sun.png"> color mode
4848
p You can reset the color mode and fallback to system color mode.
4949
button(id="button") Reset
5050
p For debugging and understanding here is the saved color mode and the OS color mode.

0 commit comments

Comments
Β (0)