b6901a49bf
Follow up from inline height #11553 related to PR #11442 we had some issues with hover styles Fixes https://github.com/twentyhq/twenty/issues/11442#issuecomment-2805893663 --------- Co-authored-by: etiennejouan <jouan.etienne@gmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
29 lines
757 B
TypeScript
29 lines
757 B
TypeScript
import { styled } from '@linaria/react';
|
|
import { isUndefined } from '@sniptt/guards';
|
|
import { OverflowingTextWithTooltip } from 'twenty-ui/display';
|
|
|
|
type TextDisplayProps = {
|
|
text: string;
|
|
displayedMaxRows?: number;
|
|
};
|
|
|
|
const StyledContainer = styled.div<{ fixHeight: boolean }>`
|
|
height: ${({ fixHeight }) => (fixHeight ? '20px' : 'auto')};
|
|
display: flex;
|
|
align-items: center;
|
|
`;
|
|
|
|
export const TextDisplay = ({ text, displayedMaxRows }: TextDisplayProps) => {
|
|
return (
|
|
<StyledContainer
|
|
fixHeight={isUndefined(displayedMaxRows) || displayedMaxRows === 1}
|
|
>
|
|
<OverflowingTextWithTooltip
|
|
text={text}
|
|
displayedMaxRows={displayedMaxRows}
|
|
isTooltipMultiline={true}
|
|
/>
|
|
</StyledContainer>
|
|
);
|
|
};
|