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}
record={record as ObjectRecord}
variant={AvatarChipVariant.Transparent}
maxWidth={150}
/>
)}

View File

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

View File

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

View File

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