@@ -5,7 +5,7 @@ import useTimeoutFn from 'react-use/lib/useTimeoutFn';
5
5
6
6
import { useHotkey } from '../../hooks/useHotkey' ;
7
7
import { ToastUtils } from '../../session/utils' ;
8
- import { SessionButtonProps } from '../basic/SessionButton' ;
8
+ import { SessionButtonProps , type SessionButtonColor } from '../basic/SessionButton' ;
9
9
import { SessionIconButtonProps , SessionLucideIconButton } from '../icon/SessionIconButton' ;
10
10
import { LUCIDE_ICONS_UNICODE } from '../icon/lucide' ;
11
11
import type { SessionIconSize } from '../icon' ;
@@ -17,12 +17,22 @@ type CopyProps = {
17
17
copyContent ?: string ;
18
18
onCopyComplete ?: ( copiedValue : string | undefined ) => void ;
19
19
hotkey ?: boolean ;
20
- } ;
20
+ } & { buttonColor : SessionButtonColor } ;
21
21
22
- type CopyToClipboardButtonProps = Omit < SessionButtonProps , 'children' | 'onClick' > & CopyProps ;
22
+ type CopyToClipboardButtonProps = Omit < SessionButtonProps , 'children' | 'onClick' | 'buttonColor' > &
23
+ CopyProps ;
23
24
24
25
export const CopyToClipboardButton = ( props : CopyToClipboardButtonProps ) => {
25
- const { copyContent, onCopyComplete, hotkey = false , text } = props ;
26
+ const {
27
+ copyContent,
28
+ onCopyComplete,
29
+ hotkey = false ,
30
+ text,
31
+ buttonType,
32
+ buttonColor,
33
+ dataTestId,
34
+ disabled,
35
+ } = props ;
26
36
const [ copied , setCopied ] = useState ( false ) ;
27
37
28
38
// reset the copied state after 5 seconds
@@ -59,9 +69,10 @@ export const CopyToClipboardButton = (props: CopyToClipboardButtonProps) => {
59
69
aria-label = { 'copy to clipboard button' }
60
70
text = { text && ! isEmpty ( text ) ? text : copied ? tr ( 'copied' ) : tr ( 'copy' ) }
61
71
onClick = { onClick }
62
- buttonColor = { props . buttonColor }
63
- dataTestId = { props . dataTestId }
64
- disabled = { props . disabled }
72
+ buttonColor = { buttonColor }
73
+ dataTestId = { dataTestId }
74
+ disabled = { disabled }
75
+ buttonType = { buttonType }
65
76
/>
66
77
) ;
67
78
} ;
0 commit comments