Skip to content

Commit f3fa6b3

Browse files
committed
more salsing yeah
1 parent 200c3d7 commit f3fa6b3

4 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎news-data.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"title": "🚗 DHH's Pagani Zonda HH BANNED From Valencia's Low-Emission Zone",
2828
"content": "Rails creator David Heinemeier Hansson's €2M hypercar doesn't meet EU emissions standards. The legendary supercar with his initials won't be allowed in Valencia's restricted area. Ironic considering he's a tech philanthropist advocating for climate action.",
2929
"category": "Tech",
30-
"size": "medium"
30+
"size": "medium",
31+
"image": "./orange-zonda-f.jpg"
3132
},
3233
{
3334
"id": 5,

‎orange-zonda-f.jpg‎

392 KB
Loading

‎script.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ function createNewsBlock(news) {
5757
const block = document.createElement('article');
5858
block.className = `news-block ${news.size}`;
5959
const linkHTML = news.link ? `<a href="${news.link}" target="_blank" class="block-link">Read more →</a>` : '';
60+
const imageHTML = news.image ? `<img src="${news.image}" alt="${news.title}" class="block-image" loading="lazy">` : '';
6061

6162
block.innerHTML = `
63+
${imageHTML}
6264
<span class="block-category">${news.category}</span>
6365
<h2 class="block-title">${news.title}</h2>
6466
<p class="block-content">${news.content}</p>

‎styles.css‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,16 @@ body {
217217
letter-spacing: 0.05em;
218218
}
219219

220+
.block-image {
221+
width: 100%;
222+
height: auto;
223+
object-fit: cover;
224+
border-radius: 8px;
225+
margin-bottom: 12px;
226+
display: block;
227+
box-shadow: 0 4px 8px rgba(255, 105, 180, 0.2);
228+
}
229+
220230
.block-title {
221231
font-size: 1.3rem;
222232
font-weight: 900;

0 commit comments

Comments
 (0)