@@ -437,6 +437,7 @@ const CopyColor = ({ hex, token, copyValue }) => {
437
437
isCopied : false
438
438
} ) ) ;
439
439
440
+ // Reset error state after 1.5 seconds
440
441
setTimeout ( ( ) => {
441
442
setCopyState ( prev => ( {
442
443
...prev ,
@@ -508,6 +509,7 @@ const CopyColor = ({ hex, token, copyValue }) => {
508
509
color : ( theme ) => theme . palette . text . primary ,
509
510
transition : "all 0.2s ease-in-out" ,
510
511
outline : "none" ,
512
+ minWidth : "fit-content" , // Prevent width changes
511
513
"&:hover" : {
512
514
backgroundColor : ( theme ) =>
513
515
theme . palette . action ?. hover || "rgba(0, 0, 0, 0.04)" ,
@@ -527,11 +529,9 @@ const CopyColor = ({ hex, token, copyValue }) => {
527
529
} ,
528
530
...( copyState . isCopied && {
529
531
backgroundColor : ( theme ) => theme . palette . success . light ,
530
- color : ( theme ) => theme . palette . success . contrastText ,
531
532
} ) ,
532
533
...( copyState . text === "Failed" && {
533
534
backgroundColor : ( theme ) => theme . palette . error . light ,
534
- color : ( theme ) => theme . palette . error . contrastText ,
535
535
} ) ,
536
536
} }
537
537
onClick = { handleCopy }
@@ -540,18 +540,20 @@ const CopyColor = ({ hex, token, copyValue }) => {
540
540
onKeyPress = { handleKeyPress }
541
541
>
542
542
< span > { getCopyValue ( ) } </ span >
543
- { copyState . isHovered && ! copyState . isCopied && (
544
- < Box
545
- component = "span"
546
- sx = { {
547
- marginLeft : "4px" ,
548
- fontSize : "0.75rem" ,
549
- opacity : 0.7 ,
550
- } }
551
- >
552
- { copyState . text }
553
- </ Box >
554
- ) }
543
+ < Box
544
+ component = "span"
545
+ sx = { {
546
+ marginLeft : "4px" ,
547
+ fontSize : "0.75rem" ,
548
+ opacity : copyState . isHovered && ! copyState . isCopied ? 0.7 : 0 ,
549
+ visibility : copyState . isHovered && ! copyState . isCopied ? "visible" : "hidden" ,
550
+ minWidth : "32px" ,
551
+ textAlign : "left" ,
552
+ transition : "opacity 0.2s ease-in-out" ,
553
+ } }
554
+ >
555
+ { copyState . text }
556
+ </ Box >
555
557
</ Box >
556
558
</ CustomTooltip >
557
559
) ;
0 commit comments