Skip to content
This repository was archived by the owner on May 19, 2023. It is now read-only.

Commit b70585c

Browse files
authored
fix(molecule): wraps tooltip text overflow (#196)
Co-authored-by: Juraj Piar <[email protected]>
1 parent f9c2eba commit b70585c

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/components/molecules/CopyTextTooltip.tsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ const useStyles = makeStyles(() => ({
1313
tooltipTitle: {
1414
display: 'flex',
1515
alignItems: 'center',
16+
overflowWrap: 'anywhere',
1617
},
1718
}))
1819

19-
const CopyTextTooltip: FC<CopyTextTooltipProps> = ({ displayElement, fullText }) => {
20+
const CopyTextTooltip: FC<CopyTextTooltipProps> = (
21+
{ displayElement, fullText },
22+
) => {
2023
const [isCopied, setIsCopied] = useState(false)
2124

2225
const classes = useStyles()
@@ -30,17 +33,21 @@ const CopyTextTooltip: FC<CopyTextTooltipProps> = ({ displayElement, fullText })
3033
</div>
3134
)
3235

36+
const onClickHandle = (): void => {
37+
navigator.clipboard.writeText(fullText)
38+
.then(() => { setIsCopied(true) })
39+
}
40+
41+
const onCloseHandle = (): void => {
42+
setIsCopied(false)
43+
}
44+
3345
return (
3446
<Tooltip
3547
interactive
3648
title={isCopied ? <Typography variant="body2">Copied!</Typography> : tooltipContent}
37-
onClick={() => {
38-
navigator.clipboard.writeText(fullText)
39-
.then(() => { setIsCopied(true) })
40-
}}
41-
onClose={() => {
42-
setIsCopied(false)
43-
}}
49+
onClick={onClickHandle}
50+
onClose={onCloseHandle}
4451
>
4552
{displayElement}
4653
</Tooltip>

0 commit comments

Comments
 (0)