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

cleanup data reference tooltips #47747

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 8 additions & 4 deletions frontend/src/metabase/components/List/List.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,22 @@
position: relative;
align-items: center;
display: flex;
gap: var(--padding-1);
}

.itemBody {
max-width: 100%;
flex: 1 0 auto;
display: flex 1 1 auto;
overflow: hidden;
}

.itemTitle {
composes: textBold from "style";
max-width: 100%;
overflow: hidden;
font-size: 1rem;

&:hover {
color: var(--mb-color-brand);
}
}

.itemSubtitle {
Expand All @@ -69,7 +74,6 @@
}

.leftIcons {
composes: mr2 from "style";
align-self: flex-start;
flex-shrink: 0;
flex-direction: row;
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/metabase/components/ListItem/ListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { memo } from "react";

import Card from "metabase/components/Card";
import S from "metabase/components/List/List.module.css";
import { Ellipsified } from "metabase/core/components/Ellipsified";
import CS from "metabase/css/core/index.css";
import { Icon } from "metabase/ui";

import { ListItemLink, ListItemName, Root } from "./ListItem.styled";
import { ListItemLink, Root } from "./ListItem.styled";

const ListItem = ({
"data-testid": dataTestId,
Expand All @@ -30,9 +31,7 @@ const ListItem = ({
</div>
<div className={S.itemBody}>
<div className={S.itemTitle}>
<ListItemName tooltip={name} tooltipMaxWidth="100%">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

tooltipMaxWidth here was the biggest sin. I think with our old tooltip, this was based on the width of the container, and our new tooltips get appended to the body so the container is the screen width.

<h3>{name}</h3>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nesting a component inside ellipsified prevented anything from actually getting an ellipsis

</ListItemName>
<Ellipsified tooltip={name}>{name}</Ellipsified>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I killed this styled component because it just made it all harder to reason about

</div>
{(description || placeholder) && (
<div className={cx(S.itemSubtitle)}>
Expand Down
12 changes: 0 additions & 12 deletions frontend/src/metabase/components/ListItem/ListItem.styled.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { css } from "@emotion/react";
import styled from "@emotion/styled";
import { Link } from "react-router";

import { Ellipsified } from "metabase/core/components/Ellipsified";

interface Props {
disabled?: boolean;
}
Expand All @@ -24,12 +21,3 @@ export const ListItemLink = styled(Link)`
color: var(--mb-color-brand);
}
`;

export const ListItemName = styled(Ellipsified)`
max-width: 100%;
overflow: hidden;

&:hover {
color: var(--mb-color-brand);
}
`;
Loading