truncate the string if overlow the text (#6166)

This PR aims to fix #6102 

I think we should dicuss a bit about how we should manage the lenght and
set the variables globally

Edit : 

@RobertoSimonini1 I used this PR to fix various problems that were left
unsolved :
- Refactor TextDisplay component, EllipsisDisplay was redundant with
OverflowingTextWithTooltip
- Removed maxWidth on TextDisplay for all other components, as it wasn't
the right way to do it, the parent container should be responsible for
width not the TextDisplay (code smell)
- Drilled-down isCentered to respect its intent in the RecordInlineCell
display of the record show page title
- Fixed RecordInlineCellEditMode so that the portal is well centered
above the record show page title
- Fixed DoubleTextInput width so that it expands normally and takes all
its parent available space.

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
RobertoSimonini1
2024-07-19 14:25:57 +02:00
committed by GitHub
parent 1b0759ef2f
commit 7b615cf97e
11 changed files with 44 additions and 24 deletions

View File

@ -1,14 +1,9 @@
import { OverflowingTextWithTooltip } from 'twenty-ui';
import { EllipsisDisplay } from './EllipsisDisplay';
type TextDisplayProps = {
text: string;
maxWidth?: number;
};
export const TextDisplay = ({ text, maxWidth }: TextDisplayProps) => (
<EllipsisDisplay maxWidth={maxWidth}>
<OverflowingTextWithTooltip text={text} />
</EllipsisDisplay>
export const TextDisplay = ({ text }: TextDisplayProps) => (
<OverflowingTextWithTooltip text={text} />
);

View File

@ -1,3 +1,4 @@
import styled from '@emotion/styled';
import {
ChangeEvent,
ClipboardEvent,
@ -5,7 +6,6 @@ import {
useRef,
useState,
} from 'react';
import styled from '@emotion/styled';
import { Key } from 'ts-key-enum';
import { FieldDoubleText } from '@/object-record/record-field/types/FieldDoubleText';
@ -21,7 +21,7 @@ const StyledContainer = styled.div`
justify-content: space-between;
input {
width: ${({ theme }) => theme.spacing(24)};
width: 100%;
}
& > input:last-child {

View File

@ -52,6 +52,8 @@ const StyledTitle = styled.div`
font-size: ${({ theme }) => theme.font.size.xl};
font-weight: ${({ theme }) => theme.font.weight.semiBold};
justify-content: center;
width: 100%;
`;
const StyledAvatarWrapper = styled.div`