Skip to content

Commit 8e9f8a2

Browse files
committed
fix(code-block): Improper padding on the line numbers (#1741)
1 parent e718f53 commit 8e9f8a2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changeset/silly-knives-kiss.md

Lines changed: 5 additions & 0 deletions
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

Lines changed: 3 additions & 3 deletions
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)