Skip to content

Commit b69389c

Browse files
committed
fix: increase target area of clipboard button
1 parent 35c3f70 commit b69389c

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

src/Common/ClipboardButton/ClipboardButton.tsx

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default function ClipboardButton({
4646
const handleEnableTippy = () => setEnableTippy(true)
4747
const handleDisableTippy = () => setEnableTippy(false)
4848
const handleCopyContent = useCallback(() => copyToClipboard(content, handleTextCopied), [content])
49+
const iconClassName = `icon-dim-${iconSize} dc__no-shrink`
4950

5051
useEffect(() => {
5152
if (!copied) return
@@ -65,28 +66,22 @@ export default function ClipboardButton({
6566
}
6667
}, [trigger, handleCopyContent])
6768
return (
68-
<div className="icon-dim-16 flex center">
69-
<Tippy
70-
className="default-tt"
71-
content={copied ? copiedTippyText : 'Copy'}
72-
placement="bottom"
73-
visible={copied || enableTippy}
74-
arrow={false}
69+
<Tippy
70+
className="default-tt"
71+
content={copied ? copiedTippyText : 'Copy'}
72+
placement="bottom"
73+
visible={copied || enableTippy}
74+
arrow={false}
75+
>
76+
<button
77+
type="button"
78+
className={`dc__outline-none-imp p-0 flex bcn-0 dc__no-border ${rootClassName}`}
79+
onMouseEnter={handleEnableTippy}
80+
onMouseLeave={handleDisableTippy}
81+
onClick={handleCopyContent}
7582
>
76-
<button
77-
type="button"
78-
className={`dc__outline-none-imp p-0 flex bcn-0 dc__no-border ${rootClassName}`}
79-
onMouseEnter={handleEnableTippy}
80-
onMouseLeave={handleDisableTippy}
81-
onClick={handleCopyContent}
82-
>
83-
{copied ? (
84-
<Check className={`icon-dim-${iconSize}`} />
85-
) : (
86-
<ICCopy className={`icon-dim-${iconSize}`} />
87-
)}
88-
</button>
89-
</Tippy>
90-
</div>
83+
{copied ? <Check className={iconClassName} /> : <ICCopy className={iconClassName} />}
84+
</button>
85+
</Tippy>
9186
)
9287
}

0 commit comments

Comments
 (0)