Skip to content

Commit 7234241

Browse files
amir-zahediclaude
andauthored
fix(MarkdownRenderer): trim first/last child margins (#1308)
The MarkdownHeading component applies mt="5" to all headings, creating unwanted top spacing when a heading is the first element rendered inside the MarkdownRenderer. Add globalStyle rules on the root to strip margin-top from the first child and margin-bottom from the last child. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 43ce2d8 commit 7234241

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@autoguru/overdrive': patch
3+
---
4+
5+
Remove excessive top/bottom margins on first/last children inside MarkdownRenderer
6+
7+
The MarkdownHeading component applies `mt="5"` to all headings, which creates
8+
unwanted spacing when a heading is the first element rendered. This adds
9+
`globalStyle` rules to the MarkdownRenderer root to strip `margin-top` from
10+
the first child and `margin-bottom` from the last child, ensuring the
11+
component sits flush within its container.

lib/components/MarkdownRenderer/MarkdownRenderer.css.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { style } from '@vanilla-extract/css';
1+
import { globalStyle, style } from '@vanilla-extract/css';
22

33
import { cssLayerComponent } from '../../styles/layers.css';
44
import { overdriveTokens as tokens } from '../../themes/theme.css';
@@ -13,3 +13,11 @@ export const root = style({
1313
},
1414
},
1515
});
16+
17+
globalStyle(`${root} > *:first-child`, {
18+
marginTop: '0 !important',
19+
});
20+
21+
globalStyle(`${root} > *:last-child`, {
22+
marginBottom: '0 !important',
23+
});

0 commit comments

Comments
 (0)