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>
55 lines
1.1 KiB
TypeScript
55 lines
1.1 KiB
TypeScript
import { styled } from '@linaria/react';
|
|
import {
|
|
Chip,
|
|
ChipAccent,
|
|
ChipProps,
|
|
ChipSize,
|
|
ChipVariant,
|
|
} from '@ui/components/chip/Chip';
|
|
import { MouseEvent } from 'react';
|
|
import { Link } from 'react-router-dom';
|
|
|
|
export type LinkChipProps = Omit<
|
|
ChipProps,
|
|
'onClick' | 'disabled' | 'clickable'
|
|
> & {
|
|
to: string;
|
|
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
};
|
|
|
|
const StyledLink = styled(Link)`
|
|
display: inline-flex;
|
|
text-decoration: none;
|
|
`;
|
|
|
|
export const LinkChip = ({
|
|
to,
|
|
size = ChipSize.Small,
|
|
label,
|
|
isLabelHidden = false,
|
|
variant = ChipVariant.Regular,
|
|
leftComponent = null,
|
|
rightComponent = null,
|
|
accent = ChipAccent.TextPrimary,
|
|
className,
|
|
maxWidth,
|
|
onClick,
|
|
}: LinkChipProps) => {
|
|
return (
|
|
<StyledLink to={to} onClick={onClick}>
|
|
<Chip
|
|
size={size}
|
|
label={label}
|
|
isLabelHidden={isLabelHidden}
|
|
clickable={true}
|
|
variant={variant}
|
|
leftComponent={leftComponent}
|
|
rightComponent={rightComponent}
|
|
accent={accent}
|
|
className={className}
|
|
maxWidth={maxWidth}
|
|
/>
|
|
</StyledLink>
|
|
);
|
|
};
|