Skip to content

Commit

Permalink
cleanup data reference tooltips (#47747)
Browse files Browse the repository at this point in the history
* cleanup data reference tooltips

* update test
# Conflicts:
#	frontend/src/metabase/components/ListItem/ListItem.styled.tsx
  • Loading branch information
iethree committed Sep 12, 2024
1 parent e7db719 commit aad7417
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
4 changes: 3 additions & 1 deletion e2e/test/scenarios/admin/datamodel/datamodel.cy.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,9 @@ describe("scenarios > admin > datamodel > segments", () => {
cy.wait(["@metadata", "@metadata", "@metadata"]);

cy.get("@emptyStateMessage").should("not.exist");
cy.findByRole("heading", { name: "Foo" }).should("be.visible");
cy.findByTestId("data-reference-list-item")
.findByText("Foo")
.should("be.visible");
});

it("should update that segment", () => {
Expand Down
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
8 changes: 4 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 @@ -23,16 +24,15 @@ const ListItem = ({
<Card
hoverable
className={cx(CS.mb2, CS.p3, CS.bgWhite, CS.rounded, CS.bordered)}
data-testid="data-reference-list-item"
>
<div className={cx(S.item)}>
<div className={S.itemIcons}>
{icon && <Icon className={S.chartIcon} name={icon} size={16} />}
</div>
<div className={S.itemBody}>
<div className={S.itemTitle}>
<ListItemName tooltip={name} tooltipMaxWidth="100%">
<h3>{name}</h3>
</ListItemName>
<Ellipsified tooltip={name}>{name}</Ellipsified>
</div>
{(description || placeholder) && (
<div className={cx(S.itemSubtitle)}>
Expand Down
10 changes: 0 additions & 10 deletions frontend/src/metabase/components/ListItem/ListItem.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { css } from "@emotion/react";
import styled from "@emotion/styled";
import { Link } from "react-router";

import { Ellipsified } from "metabase/core/components/Ellipsified";
import { color } from "metabase/lib/colors";

interface Props {
Expand All @@ -25,12 +24,3 @@ export const ListItemLink = styled(Link)`
color: ${color("brand")};
}
`;

export const ListItemName = styled(Ellipsified)`
max-width: 100%;
overflow: hidden;
&:hover {
color: ${color("brand")};
}
`;

0 comments on commit aad7417

Please sign in to comment.