Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Minor visual improvements for embedding hub (#63813)

Phoomparin Mano0fb061b83911
diff --git a/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHubAdminSettingsPage.tsx b/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHubAdminSettingsPage.tsx
index 41fac70e497..f6746565376 100644
--- a/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHubAdminSettingsPage.tsx
+++ b/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHubAdminSettingsPage.tsx
@@ -22,7 +22,7 @@ export const EmbeddingHubAdminSettingsPage = () => {
<EmbeddingHub />
- <Stack ml="2.9rem">
+ <Stack ml="2.7rem">
<RelatedSettingsSection
items={getModularEmbeddingRelatedSettingItems()}
/>
diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.css b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.css
index 37c20c74f37..6a3ab9b4efa 100644
--- a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.css
+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.css
@@ -10,7 +10,11 @@
.verticalSeparator {
--stepper-outline-thickness: 0.0625rem;
- --stepper-outline-color: var(--mb-color-border);
+ --stepper-outline-color: color-mix(
+ in srgb,
+ var(--mb-color-border),
+ black 14%
+ );
}
.step:not(.stepDone) .stepIcon {
@@ -28,7 +32,7 @@
}
.stepWrapper {
- margin-right: 0.625rem;
+ margin-right: 0.5rem;
}
.stepBody {
@@ -44,31 +48,37 @@
border: 1px solid var(--mb-color-border) !important;
cursor: pointer;
transition:
- box-shadow 250ms ease,
+ background-color 250ms ease,
border 250ms ease;
padding: 0.94rem 1.25rem;
height: 8.75rem;
- max-width: 23.75rem;
text-align: left;
+ width: 100%;
+ box-shadow: none;
}
-.stepCard:not(.optionalStepCard) {
+.stepCardLink {
width: 100%;
}
-.optionalStepCard {
+.optionalStepCard,
+.stepCardLink:has(.optionalStepCard) {
max-width: 15.625rem;
}
+.requiredStepCard,
+.stepCardLink:has(.requiredStepCard) {
+ max-width: 30rem;
+}
+
.lockedStepCard {
cursor: not-allowed;
}
.stepCard:not(.lockedStepCard):hover {
- border: 1px solid var(--mb-color-focus) !important;
+ background-color: var(--mb-color-background-hover);
}
.stepCard.nextStepCard {
- border: 1px solid var(--mb-color-focus) !important;
- box-shadow: 0 2px 24px 0 var(--mb-color-shadow-embedding-hub-card);
+ border: 1px solid var(--mb-color-metabase-brand) !important;
}
diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx
index 34b9c04830e..af756ea5b8e 100644
--- a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx
+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx
@@ -93,6 +93,7 @@ export const StepperWithCards = ({ steps }: { steps: StepperStep[] }) => {
<CardAction card={card} key={card.id}>
<Card
className={cx(S.stepCard, {
+ [S.requiredStepCard]: !card.optional,
[S.optionalStepCard]: card.optional,
[S.lockedStepCard]: card.locked,
[S.nextStepCard]: isNextCard,
@@ -130,18 +131,35 @@ export const StepperWithCards = ({ steps }: { steps: StepperStep[] }) => {
<Flex justify="flex-end">
{match(card)
.with({ done: true }, () => (
- <Text
- size="sm"
- c="var(--mb-color-success-darker)"
- >
- {t`Done`}
- </Text>
+ <Group gap="xs">
+ <Icon
+ name="check"
+ c="var(--mb-color-success-darker)"
+ size={12}
+ />
+ <Text
+ size="sm"
+ c="var(--mb-color-success-darker)"
+ >
+ {t`Done`}
+ </Text>
+ </Group>
))
.with({ locked: true }, () => (
- <Icon
- name="lock"
- c="var(--mb-color-text-secondary)"
- />
+ <Group gap="xs">
+ <Icon
+ name="lock"
+ c="var(--mb-color-text-secondary)"
+ size={12}
+ />
+
+ <Text
+ c="var(--mb-color-text-secondary)"
+ fz={12}
+ >
+ {t`Complete the other steps to unlock`}
+ </Text>
+ </Group>
))
.with({ optional: true }, () => (
<Text
@@ -187,6 +205,10 @@ const CardAction = ({
return children;
}
- return <Link to={to}>{children}</Link>;
+ return (
+ <Link to={to} className={S.stepCardLink}>
+ {children}
+ </Link>
+ );
})
.otherwise(() => children);
diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsx b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsx
index b51d4f2fbbd..3e6144009c7 100644
--- a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsx
+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsx
@@ -1,6 +1,6 @@
import userEvent from "@testing-library/user-event";
-import { render, screen } from "__support__/ui";
+import { render, screen, within } from "__support__/ui";
import type { StepperCardClickAction, StepperStep } from "./StepperWithCards";
import { StepperWithCards } from "./StepperWithCards";
@@ -30,7 +30,7 @@ const createMockSteps = (
};
describe("StepperWithCards", () => {
- it("should not automatically tick off former steps when completing a later step", () => {
+ it("should not automatically tick off former steps when completing a later step", async () => {
const steps = createMockSteps([
{
id: "step1",
@@ -68,12 +68,20 @@ describe("StepperWithCards", () => {
expect(allSteps[1]).toHaveAttribute("data-done", "false");
expect(allSteps[2]).toHaveAttribute("data-done", "true");
- // Only one check icon should be visible.
- const checkIcons = screen.getAllByLabelText("check icon");
- expect(checkIcons).toHaveLength(1);
+ // stepper header + 3 cards are done
+ expect(screen.getAllByLabelText("check icon")).toHaveLength(4);
+
+ // each card header should have a check icon if done
+ for (const id of [3, 5, 6]) {
+ expect(
+ await within(screen.getByTestId(`step-card-${id}`)).findByLabelText(
+ "check icon",
+ ),
+ ).toBeInTheDocument();
+ }
});
- it("should consider optional cards as completed when determining step completion", () => {
+ it("should consider optional cards as completed when determining step completion", async () => {
const steps = createMockSteps([
{
id: "step1",
@@ -93,8 +101,11 @@ describe("StepperWithCards", () => {
// Only the first step should be marked as done.
expect(allSteps[0]).toHaveAttribute("data-done", "true");
- const checkIcons = screen.getAllByLabelText("check icon");
- expect(checkIcons).toHaveLength(1);
+ // step header + done card should have check icons
+ expect(screen.getAllByLabelText("check icon")).toHaveLength(2);
+ await within(screen.getByTestId(`step-card-1`)).findByLabelText(
+ "check icon",
+ );
});
it("should disable locked cards", () => {