Skip to content

Commit e62b58f

Browse files
committedNov 8, 2024
fix(code-block): Improper padding on the line numbers (#1741)
1 parent 93de4ce commit e62b58f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed
 

‎.changeset/silly-knives-kiss.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@react-email/code-block": patch
3+
---
4+
5+
fix improper padding on the line numbers

‎packages/code-block/src/code-block.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ export const CodeBlock = React.forwardRef<HTMLPreElement, CodeBlockProps>(
9595
<code>
9696
{tokensPerLine.map((tokensForLine, lineIndex) => (
9797
<p key={lineIndex} style={{ margin: 0, minHeight: "1em" }}>
98-
{Boolean(props.lineNumbers) && (
98+
{props.lineNumbers ? (
9999
<span
100-
style={{ paddingRight: 30, fontFamily: props.fontFamily }}
100+
style={{ maxWidth: "1.875em", fontFamily: props.fontFamily }}
101101
>
102102
{lineIndex + 1}
103103
</span>
104-
)}
104+
) : null}
105105

106106
{tokensForLine.map((token, i) => (
107107
<CodeBlockLine

0 commit comments

Comments
 (0)