Chip untitled modification (#11498)

Fixes https://github.com/twentyhq/core-team-issues/issues/663
This commit is contained in:
Guillim
2025-04-14 17:33:41 +02:00
committed by GitHub
parent d4deca45e8
commit 8a3f8ef324
7 changed files with 67 additions and 17 deletions

View File

@ -43,12 +43,17 @@ const StyledIconsContainer = styled.div`
display: flex;
`;
const StyledEmptyText = styled.div`
color: ${({ theme }) => theme.font.color.tertiary};
`;
export type CommandMenuContextChipProps = {
Icons: React.ReactNode[];
text?: string;
onClick?: () => void;
testId?: string;
maxWidth?: string;
forceEmptyText?: boolean;
};
export const CommandMenuContextChip = ({
@ -57,6 +62,7 @@ export const CommandMenuContextChip = ({
onClick,
testId,
maxWidth,
forceEmptyText = false,
}: CommandMenuContextChipProps) => {
return (
<StyledChip
@ -70,7 +76,13 @@ export const CommandMenuContextChip = ({
<Fragment key={index}>{Icon}</Fragment>
))}
</StyledIconsContainer>
{text && <OverflowingTextWithTooltip text={text} />}
{text?.trim() ? (
<OverflowingTextWithTooltip text={text} />
) : !forceEmptyText ? (
<StyledEmptyText>Untitled</StyledEmptyText>
) : (
''
)}
</StyledChip>
);
};