1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-29 01:15:48 +02:00

chore: make truncator a span (#9272)

https://linear.app/unleash/issue/2-3255/make-truncator-a-span-instead-of-a-box

Makes the Truncator a `span` instead of a `Box`.

This should make it more flexible and help us avoid DOM nesting errors.
This commit is contained in:
Nuno Góis 2025-02-10 12:29:58 +00:00 committed by GitHub
parent bf9fdd4f8d
commit 3bc72c84e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,6 +39,7 @@ export const Truncator = ({
arrow,
tooltipProps,
children,
component = 'span',
...props
}: ITruncatorProps) => {
const [isTruncated, setIsTruncated] = useState(false);
@ -69,7 +70,12 @@ export const Truncator = ({
return (
<Tooltip title={isTruncated ? tooltipTitle : ''} {...otherTooltipProps}>
<StyledTruncatorContainer ref={ref} lines={lines} {...props}>
<StyledTruncatorContainer
ref={ref}
lines={lines}
component={component}
{...props}
>
{children}
</StyledTruncatorContainer>
</Tooltip>