1- import { useState , useRef } from 'react' ;
21import { Button , Tooltip , makeStyles } from '@fluentui/react-components' ;
3- import { translateMessage } from '../../../utils/translate-messages' ;
42import { CheckmarkRegular , CopyRegular } from '@fluentui/react-icons' ;
3+ import { useRef , useState } from 'react' ;
4+ import { translateMessage } from '../../../utils/translate-messages' ;
55
66interface ICopyButtonProps {
77 style ?: React . CSSProperties ;
8- handleOnClick : Function ;
8+ handleOnClick : ( props : ICopyButtonProps ) => void ;
99 className ?: string ;
1010 isIconButton : boolean ;
1111}
@@ -23,7 +23,9 @@ export default function CopyButton(props: ICopyButtonProps) {
2323 const copyRef = useRef < HTMLButtonElement > ( null ) ;
2424 const styles = useStyles ( ) ;
2525
26- const copyLabel : string = ! copied ? translateMessage ( 'Copy' ) : translateMessage ( 'Copied' ) ;
26+ const copyLabel : string = ! copied
27+ ? translateMessage ( 'Copy' )
28+ : translateMessage ( 'Copied' ) ;
2729
2830 const handleCopyClick = async ( ) => {
2931 props . handleOnClick ( props ) ;
@@ -40,9 +42,9 @@ export default function CopyButton(props: ICopyButtonProps) {
4042 return (
4143 < >
4244 { props . isIconButton ? (
43- < Tooltip content = { copyLabel } relationship = 'label' >
45+ < Tooltip withArrow content = { copyLabel } relationship = 'label' >
4446 < Button
45- appearance = " subtle"
47+ appearance = ' subtle'
4648 icon = { copied ? < CheckmarkRegular /> : < CopyRegular /> }
4749 aria-label = { copyLabel }
4850 onClick = { handleCopyClick }
@@ -52,14 +54,10 @@ export default function CopyButton(props: ICopyButtonProps) {
5254 />
5355 </ Tooltip >
5456 ) : (
55- < Button
56- appearance = "primary"
57- onClick = { handleCopyClick }
58- ref = { copyRef }
59- >
57+ < Button appearance = 'primary' onClick = { handleCopyClick } ref = { copyRef } >
6058 { copyLabel }
6159 </ Button >
6260 ) }
6361 </ >
6462 ) ;
65- }
63+ }
0 commit comments