Skip to content

Commit c11f6cf

Browse files
committed
fix: keep projects card visible when empty
1 parent d975d0f commit c11f6cf

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

assets/js/site.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,18 @@
161161

162162
const cards = byId('home-cards');
163163
clear(cards);
164-
(site.home.cards || []).filter((card) => (card.route !== 'membros' || state.members.length)
165-
&& (card.route !== 'projetos' || state.projects.length)).forEach((card, index) => {
166-
const cardLink = element('a', { class: 'card', href: `#${card.route}` });
167-
cardLink.append(
164+
(site.home.cards || []).filter((card) => card.route !== 'membros' || state.members.length).forEach((card, index) => {
165+
const hasDestination = card.route !== 'projetos' || state.projects.length;
166+
const cardElement = hasDestination
167+
? element('a', { class: 'card', href: `#${card.route}` })
168+
: element('article', { class: 'card' });
169+
cardElement.append(
168170
element('span', { class: 'card-index', text: String(index + 1).padStart(2, '0') }),
169171
element('h3', { text: pick(card.title) }),
170172
element('p', { text: pick(card.text) }),
171-
element('span', { class: 'card-cta', text: `${pick(card.cta)} ↓` })
173+
element('span', { class: 'card-cta', text: hasDestination ? `${pick(card.cta)} ↓` : pick(card.cta) })
172174
);
173-
cards.append(cardLink);
175+
cards.append(cardElement);
174176
});
175177

176178
const next = byId('next-events');

0 commit comments

Comments
 (0)