mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
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:
@@ -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>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user