Skip to content

Commit 27c311c

Browse files
authored
Update newsy.html
1 parent 8478639 commit 27c311c

1 file changed

Lines changed: 6 additions & 19 deletions

File tree

‎newsy.html‎

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
---
55

66
<style>
7-
/* SEKCJA NAGŁÓWKA I WYSZUKIWARKI */
87
.newsy-hero {
98
max-width: 1200px;
109
margin: 0 auto 30px auto;
@@ -31,7 +30,6 @@
3130
color: #fff;
3231
}
3332

34-
/* PASEK FILTRÓW KATEGORII (DYNAMICZNY) */
3533
.newsy-filters {
3634
max-width: 1200px;
3735
margin: 0 auto 30px auto;
@@ -66,7 +64,6 @@
6664
color: #0f172a;
6765
}
6866

69-
/* WYSZUKIWARKA W STYLU TERMINALA */
7067
.search-container {
7168
position: relative;
7269
width: 100%;
@@ -103,7 +100,6 @@
103100
pointer-events: none;
104101
}
105102

106-
/* SIATKA KAFELKÓW NEWSÓW */
107103
.newsy-grid {
108104
max-width: 1200px;
109105
margin: 0 auto;
@@ -146,7 +142,6 @@
146142
background: var(--accent-blue);
147143
}
148144

149-
/* MINIATURKA ZDJĘCIA NA KAFELKU */
150145
.news-card-thumb {
151146
width: 100%;
152147
height: 200px;
@@ -239,24 +234,18 @@
239234
<h1>Tech Briefs & News</h1>
240235
</div>
241236

242-
<!-- WYSZUKIWARKA -->
243237
<div class="search-container">
244238
<span class="search-icon">&gt;</span>
245239
<input type="text" id="newsSearch" class="search-input" placeholder="Szukaj po tytule newsa...">
246240
</div>
247241
</div>
248242
</div>
249243

250-
<!-- DYNAMICZNY PASEK FILTRÓW KATEGORII (Pobiera kategorie bezpośrednio z postów) -->
251244
<div class="newsy-filters" id="categoryFilters">
252245
<button class="filter-btn active" data-filter="all">Wszystkie</button>
253246
{% assign raw_cats = "" %}
254247
{% for post in site.newsy %}
255-
{% if post.categories %}
256-
{% for cat in post.categories %}
257-
{% assign raw_cats = raw_cats | append: cat | append: "," %}
258-
{% endfor %}
259-
{% elsif post.category %}
248+
{% if post.category %}
260249
{% assign raw_cats = raw_cats | append: post.category | append: "," %}
261250
{% endif %}
262251
{% endfor %}
@@ -271,7 +260,6 @@ <h1>Tech Briefs & News</h1>
271260

272261
<div class="newsy-grid" id="newsGrid">
273262
{% for post in site.newsy %}
274-
<!-- BEZPIECZNE POBIERANIE MINIATURKI (Najpierw zmienna 'image', potem szukanie w tekście) -->
275263
{% assign post_thumb = post.image %}
276264
{% unless post_thumb %}
277265
{% if post.content contains '<img' %}
@@ -283,18 +271,17 @@ <h1>Tech Briefs & News</h1>
283271
{% endif %}
284272
{% endunless %}
285273

286-
<!-- OBSŁUGA WIELU KATEGORII W ATRYBUCIE DATA -->
287-
{% capture cat_attr %}{% if post.categories %}{% for c in post.categories %}{{ c | downcase }} {% endfor %}{% else %}{{ post.category | default: "brief" | downcase }}{% endif %}{% endcapture %}
274+
{% assign post_cat = post.category | default: "brief" | downcase %}
288275

289-
<a href="{{ post.url }}" class="news-card" data-title="{{ post.title | downcase }}" data-categories="{{ cat_attr | strip }}">
276+
<a href="{{ post.url }}" class="news-card" data-title="{{ post.title | downcase }}" data-category="{{ post_cat }}">
290277
<div style="display: flex; flex-direction: column; height: 100%;">
291278
{% if post_thumb %}
292279
<img src="{{ post_thumb }}" alt="{{ post.title }}" class="news-card-thumb">
293280
{% endif %}
294281
<div class="news-card-content">
295282
<div>
296283
<div class="news-card-meta">
297-
<span class="news-card-tag">[{{ post.category | default: post.categories.first | default: "BRIEF" | upcase }}]</span>
284+
<span class="news-card-tag">[{{ post.category | default: "BRIEF" | upcase }}]</span>
298285
<span>// {{ post.date | date: "%Y.%m.%d" }}</span>
299286
</div>
300287
<h2 class="news-card-title">{{ post.title }}</h2>
@@ -335,9 +322,9 @@ <h2 class="news-card-title">{{ post.title }}</h2>
335322

336323
cards.forEach(card => {
337324
const title = card.getAttribute('data-title');
338-
const categories = card.getAttribute('data-categories');
325+
const category = card.getAttribute('data-category');
339326

340-
const matchesCategory = (currentCategory === 'all' || categories.includes(currentCategory));
327+
const matchesCategory = (currentCategory === 'all' || category.includes(currentCategory));
341328
const matchesQuery = title.includes(currentQuery);
342329

343330
if (matchesCategory && matchesQuery) {

0 commit comments

Comments
 (0)