Skip to content

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

Migrate subscriptions sidebar pulse card from Emotion to Mantine (#74999)

Andrei Chernykh49251fcf7991
diff --git a/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/PulsesListSidebar.module.css b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/PulsesListSidebar.module.css
new file mode 100644
index 00000000000..98345c2f79f
--- /dev/null
+++ b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/PulsesListSidebar.module.css
@@ -0,0 +1,11 @@
+.pulseCard {
+ margin-bottom: var(--mantine-spacing-xl);
+}
+
+.pulseCardEditable {
+ cursor: pointer;
+
+ &:hover {
+ background-color: var(--mb-color-brand);
+ }
+}
diff --git a/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/PulsesListSidebar.styled.tsx b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/PulsesListSidebar.styled.tsx
deleted file mode 100644
index 609c95d0a01..00000000000
--- a/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/PulsesListSidebar.styled.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-// eslint-disable-next-line no-restricted-imports
-import { css } from "@emotion/react";
-// eslint-disable-next-line no-restricted-imports
-import styled from "@emotion/styled";
-import type { ComponentPropsWithoutRef, ComponentType } from "react";
-
-import type { CardProps } from "metabase/ui";
-import { Card } from "metabase/ui";
-
-type PulseCardProps = CardProps &
- ComponentPropsWithoutRef<"div"> & {
- canEdit: boolean;
- };
-
-export const PulseCard = styled(Card)<{ canEdit: boolean }>`
- margin-bottom: 2rem;
-
- ${({ canEdit }) =>
- canEdit &&
- css`
- cursor: pointer;
-
- &:hover {
- background-color: var(--mb-color-brand);
- }
- `}
-` as unknown as ComponentType<PulseCardProps>;
-
-export const SidebarActions = styled.div`
- display: flex;
- align-items: center;
-`;
diff --git a/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/PulsesListSidebar.tsx b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/PulsesListSidebar.tsx
index fbd626018db..cbd0976ba42 100644
--- a/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/PulsesListSidebar.tsx
+++ b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/PulsesListSidebar.tsx
@@ -10,7 +10,7 @@ import { formatDateValue } from "metabase/parameters/utils/date-formatting";
import { getActivePulseParameters } from "metabase/pulse";
import { connect } from "metabase/redux";
import type { State } from "metabase/redux/store";
-import { Button, Icon, Tooltip } from "metabase/ui";
+import { Button, Card, Flex, Icon, Tooltip } from "metabase/ui";
import { conjunct, formatTimeWithUnit } from "metabase/utils/formatting";
import { formatFrame } from "metabase/utils/time-dayjs";
import { formatDateTimeWithUnit } from "metabase/visualizations/lib/formatting";
@@ -24,7 +24,7 @@ import type {
import { getParameters } from "../../selectors";
-import { PulseCard, SidebarActions } from "./PulsesListSidebar.styled";
+import S from "./PulsesListSidebar.module.css";
type PulsesListSidebarOwnProps = {
pulses: DashboardSubscription[];
@@ -72,7 +72,7 @@ function _PulsesListSidebar({
>
<Subhead>{t`Subscriptions`}</Subhead>
- <SidebarActions>
+ <Flex align="center">
<Tooltip label={createSubscriptionLabel}>
<Button
aria-label={createSubscriptionLabel}
@@ -93,17 +93,17 @@ function _PulsesListSidebar({
onClick={onCancel}
/>
</Tooltip>
- </SidebarActions>
+ </Flex>
</div>
<div className={cx(CS.my2, CS.mx4)}>
{pulses.map((pulse) => {
const canEdit = canEditPulse(pulse, formInput);
return (
- <PulseCard
+ <Card
aria-label="Pulse Card"
key={pulse.id}
- canEdit={canEdit}
+ className={cx(S.pulseCard, { [S.pulseCardEditable]: canEdit })}
p={0}
radius="md"
shadow="none"
@@ -122,6 +122,7 @@ function _PulsesListSidebar({
className={cx(
CS.flex,
CS.alignCenter,
+ CS.mb1,
CS.hoverChild,
CS.hoverInherit,
)}
@@ -133,8 +134,7 @@ function _PulsesListSidebar({
: "slack"
}
className={CS.mr1}
- style={{ paddingBottom: "5px" }}
- size={16}
+ size={12}
/>
<Label className={cx(CS.hoverChild, CS.hoverInherit)} mb="0">
{friendlySchedule(pulse.channels[0])}
@@ -142,7 +142,7 @@ function _PulsesListSidebar({
</div>
<PulseDetails pulse={pulse} parameters={parameters} />
</div>
- </PulseCard>
+ </Card>
);
})}
</div>