File tree Expand file tree Collapse file tree
apps/webapp/app/components/primitives Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ type CopyButtonProps = {
2727 buttonClassName ?: string ;
2828 showTooltip ?: boolean ;
2929 buttonVariant ?: "primary" | "secondary" | "tertiary" | "minimal" ;
30+ children ?: React . ReactNode ;
3031} ;
3132
3233export function CopyButton ( {
@@ -37,6 +38,7 @@ export function CopyButton({
3738 buttonClassName,
3839 showTooltip = true ,
3940 buttonVariant = "tertiary" ,
41+ children,
4042} : CopyButtonProps ) {
4143 const { copy, copied } = useCopy ( value ) ;
4244
@@ -66,22 +68,25 @@ export function CopyButton({
6668 variant = { `${ buttonVariant } /${ size === "extra-small" ? "small" : size } ` }
6769 onClick = { copy }
6870 className = { cn ( "shrink-0" , buttonClassName ) }
71+ LeadingIcon = {
72+ copied ? (
73+ < ClipboardCheckIcon
74+ className = { cn (
75+ iconSize ,
76+ buttonVariant === "primary" ? "text-background-dimmed" : "text-green-500"
77+ ) }
78+ />
79+ ) : (
80+ < ClipboardIcon
81+ className = { cn (
82+ iconSize ,
83+ buttonVariant === "primary" ? "text-background-dimmed" : "text-text-dimmed"
84+ ) }
85+ />
86+ )
87+ }
6988 >
70- { copied ? (
71- < ClipboardCheckIcon
72- className = { cn (
73- iconSize ,
74- buttonVariant === "primary" ? "text-background-dimmed" : "text-green-500"
75- ) }
76- />
77- ) : (
78- < ClipboardIcon
79- className = { cn (
80- iconSize ,
81- buttonVariant === "primary" ? "text-background-dimmed" : "text-text-dimmed"
82- ) }
83- />
84- ) }
89+ { children }
8590 </ Button >
8691 ) ;
8792
You can’t perform that action at this time.
0 commit comments