fix(ui): Fixed CodeBlock line number width (#5640)

**What**
- Fixes the width of lineNumbers in the CodeBlock component according to the widest number.
- Introduces a new prop on snippets that allows users to hide the copy button. Also updated docs to reflect this.

Before:
![image](https://github.com/medusajs/medusa/assets/45367945/07852c2e-434c-44df-93b7-4078148cb74f)

After:
<img width="742" alt="image" src="https://github.com/medusajs/medusa/assets/45367945/5ce845f7-b8c7-411c-abfb-fa03448aeb1a">

Closes #5639
This commit is contained in:
Kasper Fabricius Kristensen
2023-11-16 11:50:04 +01:00
committed by GitHub
parent 95aa5a2d28
commit a67a8e7e90
4 changed files with 76 additions and 18 deletions

View File

@@ -8,7 +8,7 @@ const codeBlockProps: PropDataMap = [
type: "object",
name: "CodeSnippet[]",
shape:
"{\n label: string\n language: string\n code: string\n hideLineNumbers?: boolean\n}[]",
"{\n label: string\n language: string\n code: string\n hideLineNumbers?: boolean\n hideCopy?: boolean\n}[]",
},
},
]