Skip to content

Commit 2dadcbd

Browse files
Adjust row-gap for image cards (#1417)
## Make row-gap in horizontal image cards match layout row-gap Use the newly added layout-gap-x in horizontal `<Card>` components that contains `<Media>`, keep the same gap for other horizontal `<Card>` components: https://github.com/user-attachments/assets/009ebb0e-b96c-4bcd-879d-d18483d1f5ab
1 parent 4c584d1 commit 2dadcbd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/grumpy-rice-mate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@obosbbl/grunnmuren-react": patch
3+
---
4+
5+
Adjust `row-gap` in horizontal `<Card>` with `<Media>` to match layout grid.

packages/react/src/card/card.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ const cardVariants = cva({
9191
'[&_[data-slot="media"]]:rounded-t-2xl', // Both Top corners are rounded
9292
],
9393
horizontal: [
94-
'gap-x-4', // Since this does not affect the layout before the flex direction is set (at breakpoint @2xl for Card with Media), we can set it here
94+
// Use more gap for horizontal cards that have media
95+
// Since this does not affect the layout before the flex direction is set (at breakpoint @2xl for Card with Media), we can set it here
96+
'has-data-[slot=media]:layout-gap-x not-has-data-[slot=media]:gap-x-4',
9597
// **** With Media ****
9698
'[&:has(>[data-slot="media"]:last-child)]:flex-col-reverse', // Always display the media at the top of the card
9799
'has-data-[slot=media]:@2xl:!flex-row', // We need !important to override the specificity (first-/last-child) of the flex-col-reverse and flex-col classes

0 commit comments

Comments
 (0)