fix(news): fill the orphan card so the grid has no empty cell

On sm+ the regular news cards sit in a 2-col grid; an odd count left an empty cell. Move the featured card out of the grid (it was col-span-full anyway, which also skewed nth-child parity) and stretch the last regular card to span both columns when it's the lone one in its row — same orphan-fill used for the admin stat cards.
This commit is contained in:
c0mrade
2026-06-01 15:49:29 +03:00
parent 97d436721a
commit 7b7ff53672

View File

@@ -429,11 +429,20 @@ export default function NewsSection() {
{/* Grid */} {/* Grid */}
{items.length > 0 && ( {items.length > 0 && (
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2"> <div className="space-y-4">
{featured && <FeaturedCard item={featured} onClick={handleFeaturedClick} />} {featured && <FeaturedCard item={featured} onClick={handleFeaturedClick} />}
{regular.map((item, i) => ( {regular.length > 0 && (
<NewsCardWrapper key={item.id} item={item} index={i} onCardClick={handleCardClick} /> <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 sm:[&>*:last-child:nth-child(odd)]:col-span-2">
))} {regular.map((item, i) => (
<NewsCardWrapper
key={item.id}
item={item}
index={i}
onCardClick={handleCardClick}
/>
))}
</div>
)}
</div> </div>
)} )}