Skip to content

Commit 0d7ea22

Browse files
authored
fix(blog): use CSS-based icons for lightbox buttons (#61)
1 parent c00a5a2 commit 0d7ea22

2 files changed

Lines changed: 42 additions & 6 deletions

File tree

src/layouts/PostLayout.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ const year = date.getFullYear();
100100
<span class="lightbox-title">Full-size image</span>
101101
<span class="lightbox-hint">Click outside or press Esc to close</span>
102102
</div>
103-
<button class="lightbox-nav lightbox-prev" aria-label="Previous image">&#8249;</button>
103+
<button class="lightbox-nav lightbox-prev" aria-label="Previous image"></button>
104104
<div class="lightbox-container">
105105
<img src="" alt="" />
106106
</div>
107-
<button class="lightbox-nav lightbox-next" aria-label="Next image">&#8250;</button>
108-
<button class="lightbox-close" aria-label="Close">&times;</button>
107+
<button class="lightbox-nav lightbox-next" aria-label="Next image"></button>
108+
<button class="lightbox-close" aria-label="Close"></button>
109109
<div class="lightbox-footer">
110110
<span class="lightbox-counter"></span>
111111
</div>

src/styles/global.css

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ code {
183183
right: 1rem;
184184
background: var(--color-primary);
185185
border: none;
186-
color: white;
187-
font-size: 1.5rem;
186+
font-size: 0;
188187
width: 2.5rem;
189188
height: 2.5rem;
190189
border-radius: 50%;
@@ -196,6 +195,24 @@ code {
196195
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
197196
}
198197

198+
.lightbox-close::before,
199+
.lightbox-close::after {
200+
content: '';
201+
position: absolute;
202+
width: 1.1rem;
203+
height: 2.5px;
204+
background: white;
205+
border-radius: 1px;
206+
}
207+
208+
.lightbox-close::before {
209+
transform: rotate(45deg);
210+
}
211+
212+
.lightbox-close::after {
213+
transform: rotate(-45deg);
214+
}
215+
199216
.lightbox-close:hover {
200217
background: var(--color-primary-hover);
201218
transform: scale(1.1);
@@ -227,7 +244,7 @@ code {
227244
background: var(--color-primary);
228245
border: none;
229246
color: white;
230-
font-size: 2rem;
247+
font-size: 0;
231248
width: 3rem;
232249
height: 3rem;
233250
border-radius: 50%;
@@ -240,6 +257,25 @@ code {
240257
z-index: 10;
241258
}
242259

260+
.lightbox-nav::before {
261+
content: '';
262+
display: block;
263+
width: 0.6rem;
264+
height: 0.6rem;
265+
border-top: 2.5px solid white;
266+
border-right: 2.5px solid white;
267+
}
268+
269+
.lightbox-prev::before {
270+
transform: rotate(-135deg);
271+
margin-left: 0.2rem;
272+
}
273+
274+
.lightbox-next::before {
275+
transform: rotate(45deg);
276+
margin-right: 0.2rem;
277+
}
278+
243279
.lightbox-nav:hover:not(.disabled) {
244280
background: var(--color-primary-hover);
245281
transform: translateY(-50%) scale(1.1);

0 commit comments

Comments
 (0)