Skip to content

Commit

Permalink
fix(misc): fix copy icon issue for code blocks (#1081)
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamgambhir97 authored Dec 5, 2024
1 parent 457ddf4 commit 0d5ad48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ export const CustomPre: React.FC<CodeBoxProps> = ({
</div>
<div className="nx-gap-4 nx-flex nx-flex-col">
<div
id="code-block-outer"
className="code-style-outer"
style={{ overflowX: "scroll", width: "100%" }}
ref={codeRef}
Expand Down Expand Up @@ -477,6 +478,7 @@ export const ModifiedPre = ({
{filename && <span className="filename">{filename}</span>}
{hasCopyCode && (
<div
id="modified-copy"
onClick={handleCopy}
className="nx-cursor-pointer nx-ml-auto nx-flex nx-gap-2 nx-items-center"
>
Expand All @@ -497,8 +499,7 @@ export const ModifiedPre = ({
</span>
</>
) : (
// <CopyIcon />
<></>
<CopyIcon />
)}
</div>
)}
Expand Down
4 changes: 4 additions & 0 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -5409,3 +5409,7 @@ div:hover > .\[div\:hover\>\&\]\:nx-opacity-100 {
grid-template-columns: 1fr;
}
}

#code-block-outer #modified-copy {
display: none;
}

0 comments on commit 0d5ad48

Please sign in to comment.