Fix #10941: Make sure content adjusts itself when resizing cell (#11392)

Regarding issue #10941:
Previously, when resizing a column relative to the record's name, the
content did not properly adjust to the selected width. This issue
occurred because the parent element (the link) was not a flex container,
preventing the child elements from resizing accordingly.
This fix makes the Chip link inline-flex to allow proper content
adjustment.
Additionally, the Chip itself is now set to width: 100% so that it fully
adapts to its parent.
A small margin of 2 * theme.spacing(1) has also been added to improve
spacing.

Files changed:
packages/twenty-ui/src/components/chip/Chip.tsx
packages/twenty-ui/src/components/chip/LinkChip.tsx

**Video:**

https://github.com/user-attachments/assets/83832c25-0b70-490f-90ed-0d391addf6f8

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Tomás Simões Cândido
2025-05-19 23:43:26 +01:00
committed by GitHub
parent 2477cad989
commit b48c8a11e0
4 changed files with 6 additions and 0 deletions

View File

@ -10,6 +10,7 @@ export const ChipFieldDisplay = () => {
labelIdentifierLink,
isLabelIdentifierCompact,
disableChipClick,
maxWidth,
} = useChipFieldDisplay();
if (!isDefined(recordValue)) {
@ -18,6 +19,7 @@ export const ChipFieldDisplay = () => {
return (
<RecordChip
maxWidth={maxWidth}
objectNameSingular={objectNameSingular}
record={recordValue}
size={ChipSize.Small}

View File

@ -19,6 +19,7 @@ export const useChipFieldDisplay = () => {
labelIdentifierLink,
isLabelIdentifierCompact,
disableChipClick,
maxWidth,
} = useContext(FieldContext);
const { chipGeneratorPerObjectPerField } = useContext(
@ -50,5 +51,6 @@ export const useChipFieldDisplay = () => {
labelIdentifierLink,
isLabelIdentifierCompact,
disableChipClick,
maxWidth,
};
};

View File

@ -48,6 +48,7 @@ export const RecordTableCellFieldContextLabelIdentifier = ({
isLabelIdentifierCompact,
displayedMaxRows: 1,
isReadOnly: isFieldReadOnly,
maxWidth: columnDefinition.size,
}}
>
{children}

View File

@ -18,6 +18,7 @@ export type LinkChipProps = Omit<
};
const StyledLink = styled(Link)`
display: inline-flex;
text-decoration: none;
`;