Skip to content

Commit 0d5ad48

Browse files
fix(misc): fix copy icon issue for code blocks (#1081)
1 parent 457ddf4 commit 0d5ad48

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

components/code.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ export const CustomPre: React.FC<CodeBoxProps> = ({
429429
</div>
430430
<div className="nx-gap-4 nx-flex nx-flex-col">
431431
<div
432+
id="code-block-outer"
432433
className="code-style-outer"
433434
style={{ overflowX: "scroll", width: "100%" }}
434435
ref={codeRef}
@@ -477,6 +478,7 @@ export const ModifiedPre = ({
477478
{filename && <span className="filename">{filename}</span>}
478479
{hasCopyCode && (
479480
<div
481+
id="modified-copy"
480482
onClick={handleCopy}
481483
className="nx-cursor-pointer nx-ml-auto nx-flex nx-gap-2 nx-items-center"
482484
>
@@ -497,8 +499,7 @@ export const ModifiedPre = ({
497499
</span>
498500
</>
499501
) : (
500-
// <CopyIcon />
501-
<></>
502+
<CopyIcon />
502503
)}
503504
</div>
504505
)}

styles/globals.css

+4
Original file line numberDiff line numberDiff line change
@@ -5409,3 +5409,7 @@ div:hover > .\[div\:hover\>\&\]\:nx-opacity-100 {
54095409
grid-template-columns: 1fr;
54105410
}
54115411
}
5412+
5413+
#code-block-outer #modified-copy {
5414+
display: none;
5415+
}

0 commit comments

Comments
 (0)