Skip to content

Commit

Permalink
fix(code-block): Improper padding on the line numbers (#1741)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmfern committed Oct 31, 2024
1 parent e718f53 commit 8e9f8a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-knives-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@react-email/code-block": patch
---

fix improper padding on the line numbers
6 changes: 3 additions & 3 deletions packages/code-block/src/code-block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ export const CodeBlock = React.forwardRef<HTMLPreElement, CodeBlockProps>(
<code>
{tokensPerLine.map((tokensForLine, lineIndex) => (
<p key={lineIndex} style={{ margin: 0, minHeight: "1em" }}>
{Boolean(props.lineNumbers) && (
{props.lineNumbers ? (
<span
style={{ paddingRight: 30, fontFamily: props.fontFamily }}
style={{ maxWidth: "1.875em", fontFamily: props.fontFamily }}
>
{lineIndex + 1}
</span>
)}
) : null}

{tokensForLine.map((token, i) => (
<CodeBlockLine
Expand Down

0 comments on commit 8e9f8a2

Please sign in to comment.