Title overflow (#9009)

fix #8803
This commit is contained in:
Guillim 2024-12-11 11:37:08 +01:00 committed by GitHub
parent c1fff908fe
commit 89f6f32243
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 5 deletions

View File

@ -307,6 +307,7 @@ export const RecordBoardCard = ({
objectNameSingular={objectMetadataItem.nameSingular} objectNameSingular={objectMetadataItem.nameSingular}
record={record as ObjectRecord} record={record as ObjectRecord}
variant={AvatarChipVariant.Transparent} variant={AvatarChipVariant.Transparent}
maxWidth={150}
/> />
)} )}

View File

@ -10,6 +10,7 @@ export type RecordIdentifierChipProps = {
record: ObjectRecord; record: ObjectRecord;
variant?: AvatarChipVariant; variant?: AvatarChipVariant;
size?: ChipSize; size?: ChipSize;
maxWidth?: number;
}; };
export const RecordIdentifierChip = ({ export const RecordIdentifierChip = ({
@ -17,6 +18,7 @@ export const RecordIdentifierChip = ({
record, record,
variant, variant,
size, size,
maxWidth,
}: RecordIdentifierChipProps) => { }: RecordIdentifierChipProps) => {
const { indexIdentifierUrl } = useContext(RecordIndexRootPropsContext); const { indexIdentifierUrl } = useContext(RecordIndexRootPropsContext);
const { recordChipData } = useRecordChipData({ const { recordChipData } = useRecordChipData({
@ -37,6 +39,7 @@ export const RecordIdentifierChip = ({
LeftIcon={LeftIcon} LeftIcon={LeftIcon}
LeftIconColor={LeftIconColor} LeftIconColor={LeftIconColor}
size={size} size={size}
maxWidth={maxWidth}
/> />
); );
}; };

View File

@ -24,6 +24,7 @@ export type AvatarChipProps = {
placeholderColorSeed?: string; placeholderColorSeed?: string;
onClick?: (event: MouseEvent) => void; onClick?: (event: MouseEvent) => void;
to?: string; to?: string;
maxWidth?: number;
}; };
export enum AvatarChipVariant { export enum AvatarChipVariant {
@ -60,6 +61,7 @@ export const AvatarChip = ({
onClick, onClick,
to, to,
size = ChipSize.Small, size = ChipSize.Small,
maxWidth,
}: AvatarChipProps) => { }: AvatarChipProps) => {
const { theme } = useContext(ThemeContext); const { theme } = useContext(ThemeContext);
@ -106,14 +108,15 @@ export const AvatarChip = ({
clickable={isDefined(onClick) || isDefined(to)} clickable={isDefined(onClick) || isDefined(to)}
onClick={to ? undefined : onClick} onClick={to ? undefined : onClick}
className={className} className={className}
maxWidth={maxWidth}
/> />
); );
return to ? ( if (!isDefined(to)) return chip;
return (
<StyledLink to={to} onClick={onClick}> <StyledLink to={to} onClick={onClick}>
{chip} {chip}
</StyledLink> </StyledLink>
) : (
chip
); );
}; };

View File

@ -64,7 +64,7 @@ const StyledContainer = withTheme(styled.div<
: 'inherit'}; : 'inherit'};
display: inline-flex; display: inline-flex;
justify-content: center; justify-content: flex-start;
gap: ${({ theme }) => theme.spacing(1)}; gap: ${({ theme }) => theme.spacing(1)};
height: ${({ theme, size }) => height: ${({ theme, size }) =>
size === ChipSize.Large ? theme.spacing(4) : theme.spacing(3)}; size === ChipSize.Large ? theme.spacing(4) : theme.spacing(3)};
@ -72,7 +72,6 @@ const StyledContainer = withTheme(styled.div<
maxWidth maxWidth
? `calc(${maxWidth}px - 2 * var(--chip-horizontal-padding))` ? `calc(${maxWidth}px - 2 * var(--chip-horizontal-padding))`
: '200px'}; : '200px'};
overflow: hidden; overflow: hidden;
padding: var(--chip-vertical-padding) var(--chip-horizontal-padding); padding: var(--chip-vertical-padding) var(--chip-horizontal-padding);
user-select: none; user-select: none;
@ -129,6 +128,7 @@ export const Chip = ({
accent = ChipAccent.TextPrimary, accent = ChipAccent.TextPrimary,
onClick, onClick,
className, className,
maxWidth,
}: ChipProps) => { }: ChipProps) => {
return ( return (
<StyledContainer <StyledContainer
@ -140,6 +140,7 @@ export const Chip = ({
variant={variant} variant={variant}
onClick={onClick} onClick={onClick}
className={className} className={className}
maxWidth={maxWidth}
> >
{leftComponent} {leftComponent}
<OverflowingTextWithTooltip size={size} text={label} /> <OverflowingTextWithTooltip size={size} text={label} />