Skip to content

Commit b5cac56

Browse files
committed
Refactor copy button implementation to use ClipboardIcon and enhance styling in ScriptItems and TextCopyBlock components
1 parent a5093eb commit b5cac56

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/app/scripts/_components/ScriptItems/InterFaces.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { Button } from "@/components/ui/button";
1+
import { Button, buttonVariants } from "@/components/ui/button";
22
import handleCopy from "@/lib/handleCopy";
3+
import { cn } from "@/lib/utils";
4+
import { ClipboardIcon } from "lucide-react";
35

46
interface Item {
57
interface?: string;
@@ -13,13 +15,13 @@ const CopyButton = ({
1315
label: string;
1416
value: string | number;
1517
}) => (
16-
<Button
17-
variant="secondary"
18-
size="sm"
19-
onClick={() => handleCopy(label, String(value))}
20-
>
18+
<span className={cn(buttonVariants({size: "sm", variant: "secondary"}), "flex items-center gap-2")}>
2119
{value}
22-
</Button>
20+
<ClipboardIcon
21+
onClick={() => handleCopy(label, String(value))}
22+
className="size-4 cursor-pointer"
23+
/>
24+
</span>
2325
);
2426

2527
export default function InterFaces({ item }: { item: Item }) {

src/lib/TextCopyBlock.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Button } from "@/components/ui/button";
22
import handleCopy from "./handleCopy";
3-
import { Copy } from "lucide-react";
3+
import { ClipboardIcon, Copy } from "lucide-react";
44

55
export default function TextCopyBlock(description: string) {
66
const pattern = /`([^`]*)`/g;
@@ -14,7 +14,7 @@ export default function TextCopyBlock(description: string) {
1414
className="bg-secondary py-1 px-2 rounded-lg inline-flex items-center gap-2"
1515
>
1616
{part}
17-
<Copy
17+
<ClipboardIcon
1818
className="size-3 cursor-pointer"
1919
onClick={() => handleCopy("command", part)}
2020
/>

0 commit comments

Comments
 (0)