Compare commits

...

2 Commits

Author SHA1 Message Date
Thuc Pham 4f96ae4134 Create tiny-cats-laugh.md 2024-10-16 17:13:40 +07:00
Thuc Pham bdbd49f62c fix: truncate document id length 2024-10-16 17:12:59 +07:00
2 changed files with 13 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"create-llama": patch
---
fix: truncate document id length
@@ -28,7 +28,13 @@ const PdfFocusProvider = dynamic(
{ ssr: false },
);
const MAX_DOCUMENT_ID_LENGTH = 30;
export default function PdfDialog(props: PdfDialogProps) {
const truncatedDocumentId =
props.documentId.length > MAX_DOCUMENT_ID_LENGTH
? `${props.documentId.slice(0, MAX_DOCUMENT_ID_LENGTH)}...`
: props.documentId;
return (
<Drawer direction="left">
<DrawerTrigger asChild>{props.trigger}</DrawerTrigger>
@@ -55,9 +61,10 @@ export default function PdfDialog(props: PdfDialogProps) {
<PdfFocusProvider>
<PDFViewer
file={{
id: props.documentId,
id: truncatedDocumentId,
url: props.url,
}}
containerClassName="first:break-all"
/>
</PdfFocusProvider>
</div>