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:
parent
bf9fdd4f8d
commit
3bc72c84e0
@ -39,6 +39,7 @@ export const Truncator = ({
|
|||||||
arrow,
|
arrow,
|
||||||
tooltipProps,
|
tooltipProps,
|
||||||
children,
|
children,
|
||||||
|
component = 'span',
|
||||||
...props
|
...props
|
||||||
}: ITruncatorProps) => {
|
}: ITruncatorProps) => {
|
||||||
const [isTruncated, setIsTruncated] = useState(false);
|
const [isTruncated, setIsTruncated] = useState(false);
|
||||||
@ -69,7 +70,12 @@ export const Truncator = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip title={isTruncated ? tooltipTitle : ''} {...otherTooltipProps}>
|
<Tooltip title={isTruncated ? tooltipTitle : ''} {...otherTooltipProps}>
|
||||||
<StyledTruncatorContainer ref={ref} lines={lines} {...props}>
|
<StyledTruncatorContainer
|
||||||
|
ref={ref}
|
||||||
|
lines={lines}
|
||||||
|
component={component}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</StyledTruncatorContainer>
|
</StyledTruncatorContainer>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
Loading…
Reference in New Issue
Block a user