11"use client" ;
22
3- import { Copy , Check } from "@phosphor-icons/react/dist/ssr" ;
3+ import { Check } from "@phosphor-icons/react/dist/ssr/Check" ;
4+ import { Copy } from "@phosphor-icons/react/dist/ssr/Copy" ;
45import { useLogger } from "@pythnetwork/app-logger" ;
56import { UnstyledButton } from "@pythnetwork/component-library/UnstyledButton" ;
67import clsx from "clsx" ;
78import { type ComponentProps , useCallback , useEffect , useState } from "react" ;
89
10+ import styles from "./index.module.scss" ;
11+
912type CopyButtonProps = ComponentProps < typeof UnstyledButton > & {
1013 text : string ;
1114} ;
@@ -51,11 +54,7 @@ export const CopyButton = ({
5154 return (
5255 < UnstyledButton
5356 onPress = { copy }
54- isDisabled = { isCopied }
55- className = { clsx (
56- "group/copy-button mx-[-0.5em] -mt-0.5 inline-block whitespace-nowrap rounded-md px-[0.5em] py-0.5 outline-none outline-0 outline-steel-600 transition data-[hovered]:bg-black/5 data-[focus-visible]:outline-2 dark:outline-steel-300 dark:data-[hovered]:bg-white/10" ,
57- className ,
58- ) }
57+ className = { clsx ( styles . copyButton , className ) }
5958 { ...( isCopied && { "data-is-copied" : true } ) }
6059 { ...props }
6160 >
@@ -64,12 +63,12 @@ export const CopyButton = ({
6463 < span >
6564 { typeof children === "function" ? children ( ...args ) : children }
6665 </ span >
67- < span className = "relative top-[0.125em] ml-1 inline-block" >
68- < span className = "opacity-50 transition-opacity duration-100 group-data-[is-copied]/copy-button:opacity-0" >
69- < Copy className = "size-[1em]" />
70- < div className = "sr-only" > Copy to clipboard</ div >
66+ < span className = { styles . iconContainer } >
67+ < span className = { styles . copyIconContainer } >
68+ < Copy className = { styles . copyIcon } />
69+ < div className = { styles . copyIconLabel } > Copy to clipboard</ div >
7170 </ span >
72- < Check className = "absolute inset-0 text-green-600 opacity-0 transition-opacity duration-100 group-data-[is-copied]/copy-button:opacity-100" />
71+ < Check className = { styles . checkIcon } />
7372 </ span >
7473 </ >
7574 ) }
0 commit comments