Skip to content

Commit 23d1dfb

Browse files
committed
[homepage] Slightly adjusts RSS display for responsiveness
1 parent 43bbb67 commit 23d1dfb

File tree

3 files changed

+43
-18
lines changed

3 files changed

+43
-18
lines changed

src/components/BlogRSS.astro

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ const feed = await parser.parseURL(feedUrl);
1515
const dateFormatter = new Intl.DateTimeFormat("en-EN", { dateStyle: "long" });
1616
---
1717

18-
<section class="blog-posts">
18+
<section class="blog-posts-container">
1919
<h2>Latest posts on Gephi's blog</h2>
20-
<div class="d-flex flex-wrap gap-4 w-100">
20+
21+
<div class="blog-posts">
2122
{
2223
feed.items.slice(0, 4).map((item) => (
2324
<article class="blog-post">
24-
{" "}
25-
{item["media:thumbnail"] && <img src={item["media:thumbnail"]?.$.url} />}
26-
<a href={item.link}>
27-
<h4>{item.title}</h4>
28-
</a>
25+
{item["media:thumbnail"] && <img alt="" src={item["media:thumbnail"]?.$.url} />}
26+
<h4>
27+
<a href={item.link}>{item.title}</a>
28+
</h4>
2929
<div>{item.contentSnippet}</div>
3030
<div class="text-end text-muted">
3131
by{" "}

src/styles/_contents.scss

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -260,27 +260,49 @@ a.no-decoration {
260260
color: inherit;
261261
}
262262

263-
.blog-posts {
264-
.blog-post {
265-
width: calc(50% - 1.5rem / 2);
263+
.blog-posts-container {
264+
margin-top: $spacer-5;
266265

267-
@include media-breakpoint-down(md) {
268-
width: 100%;
269-
}
266+
h2 {
267+
padding: 0 $base-padding;
268+
}
269+
270+
.blog-posts {
271+
display: flex;
272+
flex-wrap: wrap;
273+
align-items: start;
274+
gap: $spacer-4;
275+
width: 100%;
276+
}
270277

271-
@extend .p-4;
278+
.blog-post {
272279
@extend .shadow;
273-
background: #fffffff6;
274-
position: relative;
280+
281+
padding: $spacer-4;
282+
width: calc(50% - 1.5rem / 2);
283+
height: auto;
284+
285+
background: $white;
275286

276287
display: flex;
277288
flex-direction: column;
278-
justify-content: space-between;
279-
row-gap: 0.5rem;
289+
gap: $spacer-3;
290+
291+
h3 {
292+
@extend .fs-3;
293+
margin: 0;
294+
}
280295
img {
281296
max-width: 100%;
282297
max-height: 50%;
283298
object-fit: contain;
284299
}
285300
}
301+
302+
@include media-breakpoint-down(md) {
303+
.blog-post {
304+
width: 100%;
305+
padding: $spacer-4 $base-padding;
306+
}
307+
}
286308
}

src/styles/_variables-override.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ $spacer-2: map.get($spacers, 2);
88
$spacer-3: map.get($spacers, 3);
99
$spacer-4: map.get($spacers, 4);
1010
$spacer-5: map.get($spacers, 5);
11+
12+
// Use this to get the proper padding for some item that has a 100vw width:
13+
$base-padding: calc(#{$spacer-4} * 0.5);

0 commit comments

Comments
 (0)