Skip to content

Commit 04ba846

Browse files
authored
Update newsy.html
1 parent 097a296 commit 04ba846

1 file changed

Lines changed: 23 additions & 33 deletions

File tree

‎newsy.html‎

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,26 @@
142142
background: var(--accent-blue);
143143
}
144144

145-
.news-card-thumb {
145+
/* MINIATURKA / IKONA NEWSA */
146+
.news-thumb {
146147
width: 100%;
147-
height: 200px;
148-
object-fit: cover;
148+
height: 170px;
149+
display: flex;
150+
align-items: center;
151+
justify-content: center;
152+
background: radial-gradient(circle at 30% 20%, rgba(0, 210, 255, 0.12), rgba(0, 0, 0, 0.55));
149153
border-bottom: 1px solid var(--border);
150-
display: block;
154+
overflow: hidden;
155+
}
156+
.news-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
157+
.news-thumb-img.is-icon { width: 96px; height: 96px; object-fit: contain; }
158+
.news-thumb-fallback {
159+
font-size: 3.2rem;
160+
width: 96px; height: 96px;
161+
display: flex; align-items: center; justify-content: center;
162+
background: rgba(0, 210, 255, 0.08);
163+
border: 1px solid rgba(0, 210, 255, 0.25);
164+
border-radius: 18px;
151165
}
152166

153167
.news-card-content {
@@ -233,7 +247,7 @@
233247
<span class="section-tag">SYSTEM / ARCHIVES</span>
234248
<h1>Tech Briefs & News</h1>
235249
</div>
236-
250+
237251
<div class="search-container">
238252
<span class="search-icon">&gt;</span>
239253
<input type="text" id="newsSearch" class="search-input" placeholder="Szukaj po tytule newsa...">
@@ -250,7 +264,7 @@ <h1>Tech Briefs & News</h1>
250264
{% endif %}
251265
{% endfor %}
252266
{% assign unique_cats = raw_cats | split: "," | uniq | sort %}
253-
267+
254268
{% for cat in unique_cats %}
255269
{% if cat != "" %}
256270
<button class="filter-btn" data-filter="{{ cat | downcase }}">{{ cat | upcase }}</button>
@@ -260,31 +274,11 @@ <h1>Tech Briefs & News</h1>
260274

261275
<div class="newsy-grid" id="newsGrid">
262276
{% for post in site.newsy %}
263-
<!-- Automatyczne wyciąganie pierwszego obrazka z treści posta -->
264-
{% assign post_thumb = nil %}
265-
{% if post.content contains '<img' %}
266-
{% assign img_tag = post.content | split: '<img' | second %}
267-
{% assign img_src = img_tag | split: 'src="' | second | split: '"' | first %}
268-
{% if img_src %}
269-
{% assign post_thumb = img_src %}
270-
{% endif %}
271-
{% endif %}
272-
{% unless post_thumb %}
273-
{% if post.content contains '![' %}
274-
{% assign md_img = post.content | split: '![' | second | split: ']' | second | split: '(' | second | split: ')' | first %}
275-
{% if md_img %}
276-
{% assign post_thumb = md_img %}
277-
{% endif %}
278-
{% endif %}
279-
{% endunless %}
280-
281277
{% assign post_cat = post.category | default: "brief" | downcase %}
282278

283-
<a href="{{ post.url }}" class="news-card" data-title="{{ post.title | downcase }}" data-category="{{ post_cat }}">
279+
<a href="{{ post.url | relative_url }}" class="news-card" data-title="{{ post.title | downcase }}" data-category="{{ post_cat }}">
284280
<div style="display: flex; flex-direction: column; height: 100%;">
285-
{% if post_thumb %}
286-
<img src="{{ post_thumb | relative_url }}" alt="{{ post.title }}" class="news-card-thumb">
287-
{% endif %}
281+
{% include news-thumb.html post=post %}
288282
<div class="news-card-content">
289283
<div>
290284
<div class="news-card-meta">
@@ -342,11 +336,7 @@ <h2 class="news-card-title">{{ post.title }}</h2>
342336
}
343337
});
344338

345-
if (visibleCount === 0) {
346-
noResults.style.display = 'block';
347-
} else {
348-
noResults.style.display = 'none';
349-
}
339+
noResults.style.display = (visibleCount === 0) ? 'block' : 'none';
350340
}
351341

352342
searchInput.addEventListener('input', (e) => {

0 commit comments

Comments
 (0)