Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: text overflow on project users access page #8853

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const RoleCell: VFC<TRoleCellProps> = ({ role, roles, value }) => {
))}
</StyledRoleDescriptions>
}
clampText
>
{value}
</TooltipLink>
Expand Down
37 changes: 27 additions & 10 deletions frontend/src/component/common/TooltipLink/TooltipLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,49 @@ import {
} from '../HtmlTooltip/HtmlTooltip';

const StyledLink = styled(Link, {
shouldForwardProp: (prop) => prop !== 'highlighted',
})<{ highlighted?: boolean }>(({ theme, highlighted }) => ({
backgroundColor: highlighted ? theme.palette.highlight : 'transparent',
color: theme.palette.text.primary,
textDecorationColor: theme.palette.text.disabled,
textDecorationStyle: 'dashed',
textUnderlineOffset: theme.spacing(0.5),
whiteSpace: 'nowrap',
}));
shouldForwardProp: (prop) => prop !== 'highlighted' && prop !== 'clampText',
})<{ highlighted?: boolean; clampText?: boolean }>(
({ theme, highlighted, clampText }) => ({
backgroundColor: highlighted ? theme.palette.highlight : 'transparent',
color: theme.palette.text.primary,
textDecorationColor: theme.palette.text.disabled,
textDecorationStyle: 'dashed',
textUnderlineOffset: theme.spacing(0.5),
whiteSpace: 'nowrap',
...(clampText
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was clamp I though we gonna use css clamp so maybe we should pick a term that doesn't have other meaning in CSS?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overflowEllipsis?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have many examples of Truncate/Truncated in the code

? {
overflow: 'hidden',
textOverflow: 'ellipsis',
maxWidth: '100%',
display: 'block',
}
: {}),
}),
);

interface ITooltipLinkProps extends LinkProps {
tooltip: ReactNode;
highlighted?: boolean;
tooltipProps?: Omit<IHtmlTooltipProps, 'title' | 'children'>;
children: ReactNode;
clampText?: boolean;
}

export const TooltipLink = ({
tooltip,
highlighted,
tooltipProps,
children,
clampText,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it need to be configurable? when do we want ellipsis vs scrollbar?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question 🙋🏼 But also: is it okay that we don't show the whole text. should we reconfigure the tables instead? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this component in many other places, mostly but not only in tables. I think it's not always in a place constrained by column width.

...props
}: ITooltipLinkProps) => (
<HtmlTooltip title={tooltip} {...tooltipProps} arrow>
<StyledLink tabIndex={0} highlighted={highlighted} {...props}>
<StyledLink
tabIndex={0}
highlighted={highlighted}
clampText={clampText}
{...props}
>
{children}
</StyledLink>
</HtmlTooltip>
Expand Down
Loading