Skip to content

Commit

Permalink
fix(Navigation/MapNode): minor fix for css [YTFRONT-4291]
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-efremoff committed Aug 12, 2024
1 parent aff83de commit e5932f8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions packages/ui/src/ui/components/Tooltip/Tooltip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,11 @@
&_block {
display: unset;
}

&_ellipsis {
max-width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
5 changes: 3 additions & 2 deletions packages/ui/src/ui/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ export type TooltipProps = Omit<
theme?: PopoverProps['theme'] | 'fix-link-colors';
children?: React.ReactNode;
useFlex?: boolean;
ellipsis?: boolean;
};

const SHOW_HIDE_DELAY = 400;

export function Tooltip(props: TooltipProps) {
const {content, className, children, theme, useFlex, ...rest} = props;
const {content, className, children, theme, useFlex, ellipsis, ...rest} = props;

const anchorRef = React.useRef<HTMLDivElement>(null);
const popoverRef = React.useRef<PopoverInstanceProps>(null);
Expand Down Expand Up @@ -66,7 +67,7 @@ export function Tooltip(props: TooltipProps) {

return (
<div
className={block({flex: useFlex, 'has-tooltip': Boolean(content)}, className)}
className={block({flex: useFlex, 'has-tooltip': Boolean(content), ellipsis}, className)}
ref={anchorRef}
onMouseOver={handleOpen}
onMouseOut={handleClose}
Expand Down
5 changes: 4 additions & 1 deletion packages/ui/src/ui/pages/accounts/AccountLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ interface Props {
className?: string;
account?: string;
cluster?: string;

inline?: boolean;
}

export function genAccountsUrl(cluster: string, account: string) {
return `/${cluster}/${Page.ACCOUNTS}/${AccountsTab.GENERAL}?account=${account}`;
}

export default function AccountLink(props: Props) {
const {cluster: propsCluster, account, className} = props;
const {cluster: propsCluster, account, className, inline} = props;
const currentCluster = useSelector(getCluster);
const cluster = propsCluster || currentCluster;

return (
<Tooltip
ellipsis={inline}
className={className}
content={
!account ? null : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class MapNodesTable extends Component {
}

static renderAccount(item, columnName) {
return <AccountLink account={item[columnName]} />;
return <AccountLink account={item[columnName]} inline />;
}

get hotkeys() {
Expand Down

0 comments on commit e5932f8

Please # to comment.