Skip to content

Commit 8a09daa

Browse files
committed
feat: enhance CopyButton integration in JsonBlock component
1 parent 7bf0630 commit 8a09daa

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/components/CopyButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const CopyButton = ({
6262
}}
6363
onMouseEnter={handleMouseEnter}
6464
onMouseLeave={handleMouseLeave}
65-
className="hover:before:bg-muted active:before:bg-secondary relative z-0 -mx-1 -my-1 items-center gap-1 px-1 py-1 transition-colors before:absolute before:inset-0 before:-z-10 before:rounded-lg before:duration-200 active:before:scale-x-[0.98] active:before:scale-y-[0.94]"
65+
className="hover:before:bg-muted active:before:bg-secondary relative z-0 -mx-1 -my-1 flex items-center gap-1 px-1 py-1 transition-colors before:absolute before:inset-0 before:-z-10 before:rounded-lg before:duration-200 active:before:scale-x-[0.98] active:before:scale-y-[0.94]"
6666
>
6767
{buttonText && <span className="mr-1 text-sm">{buttonText}</span>}
6868
<Copy className="size-4 flex-none" />

src/modules/JsonBlock.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ const JsonBlock = ({
4646
displayObjectSize={false}
4747
enableClipboard={false}
4848
collapsed={collapsed}
49+
shortenTextAfterLength={100}
4950
style={defaultJsonViewStyle}
5051
/>
5152
</div>
52-
{enableClipboard && <CopyButton textToCopy={rawToCopy} />}
53+
{enableClipboard && (
54+
<CopyButton buttonText="Copy Json" textToCopy={rawToCopy} />
55+
)}
5356
</div>
5457
);
5558
};

0 commit comments

Comments
 (0)