Skip to content

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

Uxw 3697 emotion css mantine status (#84318)

Nick Fitzpatricke9fea94cd946
diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AnalyticsExportStatus.tsx b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AnalyticsExportStatus.tsx
index 69870f57ec2..f09e4f9bb79 100644
--- a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AnalyticsExportStatus.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AnalyticsExportStatus.tsx
@@ -1,7 +1,7 @@
import { t } from "ttag";
import ErrorBoundary from "metabase/common/components/ErrorBoundary";
-import StatusLarge from "metabase/status/components/StatusLarge";
+import { StatusLarge } from "metabase/status/components/StatusLarge";
import useStatusVisibility from "metabase/status/hooks/use-status-visibility";
import { ANALYTICS_EXPORT_CACHE_KEY, useExportAnalyticsMutation } from "../api";
diff --git a/enterprise/frontend/src/metabase-enterprise/google_drive/GdriveSyncStatus.tsx b/enterprise/frontend/src/metabase-enterprise/google_drive/GdriveSyncStatus.tsx
index 7e4cf8596d6..4378d0acd8e 100644
--- a/enterprise/frontend/src/metabase-enterprise/google_drive/GdriveSyncStatus.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/google_drive/GdriveSyncStatus.tsx
@@ -8,7 +8,7 @@ import { tag } from "metabase/api/tags";
import { getErrorMessage } from "metabase/api/utils";
import { getUser } from "metabase/current-user";
import { useDispatch, useSelector } from "metabase/redux";
-import StatusLarge from "metabase/status/components/StatusLarge";
+import { StatusLarge } from "metabase/status/components/StatusLarge";
import { useGetGsheetsFolderQuery } from "metabase-enterprise/api";
import { EnterpriseApi } from "metabase-enterprise/api/api";
import type { DatabaseId, GdrivePayload } from "metabase-types/api";
diff --git a/enterprise/frontend/src/metabase-enterprise/replacement/components/SourceReplacementStatus/SourceReplacementStatus.tsx b/enterprise/frontend/src/metabase-enterprise/replacement/components/SourceReplacementStatus/SourceReplacementStatus.tsx
index ea906e96e49..7d42f2d1f19 100644
--- a/enterprise/frontend/src/metabase-enterprise/replacement/components/SourceReplacementStatus/SourceReplacementStatus.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/replacement/components/SourceReplacementStatus/SourceReplacementStatus.tsx
@@ -5,7 +5,7 @@ import { Api, skipToken, useGetCardQuery } from "metabase/api";
import { useGetTableQuery } from "metabase/api/table";
import type { TagType } from "metabase/api/tags";
import { useDispatch } from "metabase/redux";
-import StatusLarge from "metabase/status/components/StatusLarge";
+import { StatusLarge } from "metabase/status/components/StatusLarge";
import StatusSmall from "metabase/status/components/StatusSmall";
import {
getIconName,
diff --git a/frontend/src/metabase/status/components/DatabaseStatusLarge/DatabaseStatusLarge.tsx b/frontend/src/metabase/status/components/DatabaseStatusLarge/DatabaseStatusLarge.tsx
index 9be406c1aa2..c9be6f2c085 100644
--- a/frontend/src/metabase/status/components/DatabaseStatusLarge/DatabaseStatusLarge.tsx
+++ b/frontend/src/metabase/status/components/DatabaseStatusLarge/DatabaseStatusLarge.tsx
@@ -7,7 +7,7 @@ import {
} from "metabase/utils/syncing";
import type { Database } from "metabase-types/api";
-import StatusLarge from "../StatusLarge";
+import { StatusLarge } from "../StatusLarge";
export type DatabaseStatusLargeProps = {
databases: Database[];
diff --git a/frontend/src/metabase/status/components/DownloadsStatusLarge/DownloadsStatusLarge.tsx b/frontend/src/metabase/status/components/DownloadsStatusLarge/DownloadsStatusLarge.tsx
index d4bebc247bf..8bd2c2dba52 100644
--- a/frontend/src/metabase/status/components/DownloadsStatusLarge/DownloadsStatusLarge.tsx
+++ b/frontend/src/metabase/status/components/DownloadsStatusLarge/DownloadsStatusLarge.tsx
@@ -3,7 +3,7 @@ import { t } from "ttag";
import type { Download } from "metabase/redux/store";
-import StatusLarge from "../StatusLarge";
+import { StatusLarge } from "../StatusLarge";
import { isCompleted, isErrored, isInProgress } from "../utils/downloads";
export interface DownloadsStatusLargeProps {
diff --git a/frontend/src/metabase/status/components/FileUploadStatusLarge/FileUploadStatusLarge.tsx b/frontend/src/metabase/status/components/FileUploadStatusLarge/FileUploadStatusLarge.tsx
index d67ed91a037..d46071bb2cc 100644
--- a/frontend/src/metabase/status/components/FileUploadStatusLarge/FileUploadStatusLarge.tsx
+++ b/frontend/src/metabase/status/components/FileUploadStatusLarge/FileUploadStatusLarge.tsx
@@ -12,7 +12,7 @@ import {
isUploadCompleted,
isUploadInProgress,
} from "../../utils";
-import StatusLarge from "../StatusLarge";
+import { StatusLarge } from "../StatusLarge";
const UPLOAD_MESSAGE_UPDATE_INTERVAL = 30 * 1000;
diff --git a/frontend/src/metabase/status/components/PublicStatusListing/PublicStatusListing.styled.tsx b/frontend/src/metabase/status/components/PublicStatusListing/PublicStatusListing.styled.tsx
deleted file mode 100644
index 239e30b25d4..00000000000
--- a/frontend/src/metabase/status/components/PublicStatusListing/PublicStatusListing.styled.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-// eslint-disable-next-line eslint-js/no-restricted-imports
-import styled from "@emotion/styled";
-
-export const PublicStatusListingRoot = styled.div`
- position: fixed;
- right: 1.5rem;
- bottom: 1.5rem;
- z-index: 2;
-`;
diff --git a/frontend/src/metabase/status/components/PublicStatusListing/PublicStatusListing.tsx b/frontend/src/metabase/status/components/PublicStatusListing/PublicStatusListing.tsx
index d0b18813f04..ed43bd7c0a9 100644
--- a/frontend/src/metabase/status/components/PublicStatusListing/PublicStatusListing.tsx
+++ b/frontend/src/metabase/status/components/PublicStatusListing/PublicStatusListing.tsx
@@ -1,15 +1,21 @@
+import CS from "metabase/css/core/index.css";
import { useCheckActiveDownloadsBeforeUnload } from "metabase/status/hooks/use-check-active-downloads-before-unload";
+import { Box } from "metabase/ui";
import { DownloadsStatus } from "../DownloadsStatus";
-import { PublicStatusListingRoot } from "./PublicStatusListing.styled";
-
export const PublicStatusListing = () => {
useCheckActiveDownloadsBeforeUnload();
return (
- <PublicStatusListingRoot data-testid="status-root-container">
+ <Box
+ className={CS.z2}
+ pos="fixed"
+ right="1.5rem"
+ bottom="1.5rem"
+ data-testid="status-root-container"
+ >
<DownloadsStatus />
- </PublicStatusListingRoot>
+ </Box>
);
};
diff --git a/frontend/src/metabase/status/components/StatusLarge/StatusLarge.module.css b/frontend/src/metabase/status/components/StatusLarge/StatusLarge.module.css
new file mode 100644
index 00000000000..e89dd071b12
--- /dev/null
+++ b/frontend/src/metabase/status/components/StatusLarge/StatusLarge.module.css
@@ -0,0 +1,4 @@
+/* The panel's shadow is not a theme token */
+.shadow {
+ box-shadow: 0 1px 12px var(--mb-color-shadow-default);
+}
diff --git a/frontend/src/metabase/status/components/StatusLarge/StatusLarge.styled.tsx b/frontend/src/metabase/status/components/StatusLarge/StatusLarge.styled.tsx
deleted file mode 100644
index 01a193ae061..00000000000
--- a/frontend/src/metabase/status/components/StatusLarge/StatusLarge.styled.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-// eslint-disable-next-line eslint-js/no-restricted-imports
-import styled from "@emotion/styled";
-
-import { IconButtonWrapper } from "metabase/common/components/IconButtonWrapper";
-import { color } from "metabase/ui/utils/colors";
-
-export const StatusRoot = styled.div`
- width: 16rem;
- border-radius: 6px;
- background-color: var(--mb-color-background_page-primary);
- box-shadow: 0 1px 12px var(--mb-color-shadow-default);
- overflow: hidden;
- margin-top: 1rem;
- border: 1px solid var(--mb-color-border-neutral);
-`;
-
-export const StatusHeader = styled.div`
- display: flex;
- align-items: center;
- padding: 0.625rem 1rem;
- background-color: var(--mb-color-core-brand);
-`;
-
-export const StatusTitle = styled.div`
- flex: 1 1 auto;
- width: 100%;
- color: var(--mb-color-background_page-secondary);
- font-size: 0.875rem;
- font-weight: bold;
- line-height: 1rem;
-`;
-
-export const StatusToggle = styled(IconButtonWrapper)`
- flex: 0 0 auto;
- color: var(--mb-color-text-primary-inverse);
-`;
-
-export const StatusBody = styled.div`
- background-color: var(--mb-color-background_page-primary);
-`;
-
-export const StatusCardRoot = styled.div<{ hasBody?: boolean }>`
- display: flex;
- align-items: ${(props) => (props.hasBody ? "flex-start" : "center")};
- margin: 0.75rem;
-`;
-
-export const StatusCardBody = styled.div`
- flex: 1 1 auto;
- margin: 0 0.75rem;
- overflow: hidden;
-`;
-
-export const StatusCardIcon = styled.div`
- display: flex;
- flex: 0 0 auto;
- align-items: center;
- justify-content: center;
- width: 2rem;
- height: 2rem;
- border-radius: 1rem;
- color: var(--mb-color-core-brand);
- background-color: var(--mb-color-background_surface-brand-subtle);
-`;
-
-export const StatusCardTitle = styled.div`
- color: var(--mb-color-text-primary);
- font-size: 0.875rem;
- font-weight: bold;
- line-height: 1rem;
- overflow: hidden;
-`;
-
-export const StatusCardDescription = styled.div`
- color: var(--mb-color-background_page-tertiary-inverse);
- font-size: 0.6875rem;
- font-weight: bold;
- line-height: 0.8125rem;
- margin-top: 0.25rem;
-`;
-
-interface StatusCardIconContainerProps {
- isError?: boolean;
-}
-
-export const StatusCardIconContainer = styled.div<StatusCardIconContainerProps>`
- flex: 0 0 auto;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 1.5rem;
- height: 1.5rem;
- border-radius: 1rem;
- color: var(--mb-color-text-primary-inverse);
- background-color: ${(props) =>
- props.isError ? color("feedback-negative") : color("feedback-positive")};
-`;
diff --git a/frontend/src/metabase/status/components/StatusLarge/StatusLarge.tsx b/frontend/src/metabase/status/components/StatusLarge/StatusLarge.tsx
index 1cb18095a47..9d358ac62e2 100644
--- a/frontend/src/metabase/status/components/StatusLarge/StatusLarge.tsx
+++ b/frontend/src/metabase/status/components/StatusLarge/StatusLarge.tsx
@@ -1,25 +1,24 @@
+import cx from "classnames";
import type { PropsWithChildren } from "react";
import { t } from "ttag";
import { Link } from "metabase/common/components/Link";
-import { Ellipsified, Icon, Loader } from "metabase/ui";
+import CS from "metabase/css/core/index.css";
+import {
+ ActionIcon,
+ Box,
+ Ellipsified,
+ Flex,
+ Icon,
+ Loader,
+ Paper,
+ Text,
+} from "metabase/ui";
import type { IconName } from "metabase-types/api";
import useStatusVisibility from "../../hooks/use-status-visibility";
-import {
- StatusBody,
- StatusCardBody,
- StatusCardDescription,
- StatusCardIcon,
- StatusCardIconContainer,
- StatusCardRoot,
- StatusCardTitle,
- StatusHeader,
- StatusRoot,
- StatusTitle,
- StatusToggle,
-} from "./StatusLarge.styled";
+import S from "./StatusLarge.module.css";
type Status = {
title: string;
@@ -44,30 +43,56 @@ export interface StatusLargeProps {
onDismiss?: () => void;
}
-const StatusLarge = ({
+export const StatusLarge = ({
status,
isActive,
onCollapse,
onDismiss,
}: StatusLargeProps) => {
return (
- <StatusRoot role="status">
- <StatusHeader>
- <StatusTitle>
+ <Paper
+ className={cx(S.shadow, CS.overflowHidden)}
+ role="status"
+ w="16rem"
+ mt="lg"
+ radius="xs"
+ withBorder
+ >
+ <Flex align="center" py="0.625rem" pl="lg" pr="md" bg="core-brand">
+ <Box
+ flex="1 1 auto"
+ w="100%"
+ c="background_page-secondary"
+ fz="md"
+ fw="bold"
+ lh="1rem"
+ >
<Ellipsified>{status.title}</Ellipsified>
- </StatusTitle>
+ </Box>
{onCollapse && (
- <StatusToggle onClick={onCollapse} aria-label={t`Collapse`}>
+ <ActionIcon
+ variant="static"
+ size="xs"
+ c="text-primary-inverse"
+ onClick={onCollapse}
+ aria-label={t`Collapse`}
+ >
<Icon name="chevrondown" />
- </StatusToggle>
+ </ActionIcon>
)}
{onDismiss && (
- <StatusToggle onClick={onDismiss} aria-label={t`Dismiss`}>
+ <ActionIcon
+ variant="static"
+ size="xs"
+ c="text-primary-inverse"
+ onClick={onDismiss}
+ aria-label={t`Dismiss`}
+ >
<Icon name="close" />
- </StatusToggle>
+ </ActionIcon>
)}
- </StatusHeader>
- <StatusBody>
+ </Flex>
+ <Box bg="background_page-primary">
{status.items.map((item) => (
<StatusCard
item={item}
@@ -75,8 +100,8 @@ const StatusLarge = ({
key={item.id ?? String(item.title)}
/>
))}
- </StatusBody>
- </StatusRoot>
+ </Box>
+ </Paper>
);
};
@@ -106,17 +131,39 @@ const StatusCard = ({
return (
<LinkWrapper item={item} key={id}>
- <StatusCardRoot hasBody={!!description}>
- <StatusCardIcon>
+ <Flex align={description ? "flex-start" : "center"} m="md">
+ <Flex
+ flex="0 0 auto"
+ align="center"
+ justify="center"
+ w="2rem"
+ h="2rem"
+ bdrs="lg"
+ c="core-brand"
+ bg="background_surface-brand-subtle"
+ >
{/* Unjustified type cast. FIXME */}
<Icon name={icon as unknown as IconName} />
- </StatusCardIcon>
- <StatusCardBody>
- <StatusCardTitle>
+ </Flex>
+ <Box flex="1 1 auto" mx="md">
+ <Box
+ className={CS.overflowHidden}
+ c="text-primary"
+ fz="md"
+ fw="bold"
+ lh="1rem"
+ >
<Ellipsified>{title}</Ellipsified>
- </StatusCardTitle>
- <StatusCardDescription>{description}</StatusCardDescription>
- </StatusCardBody>
+ </Box>
+ <Text
+ size="xs"
+ fw="bold"
+ mt="xxs"
+ c="background_page-tertiary-inverse"
+ >
+ {description}
+ </Text>
+ </Box>
{isInProgress && <Loader size="md" color="core-brand" />}
{isCompleted && (
<StatusCardIconContainer>
@@ -128,10 +175,29 @@ const StatusCard = ({
<Icon name="warning" size={12} />
</StatusCardIconContainer>
)}
- </StatusCardRoot>
+ </Flex>
</LinkWrapper>
);
};
-// eslint-disable-next-line import/no-default-export -- deprecated usage
-export default StatusLarge;
+interface StatusCardIconContainerProps {
+ isError?: boolean;
+}
+
+const StatusCardIconContainer = ({
+ isError,
+ children,
+}: PropsWithChildren<StatusCardIconContainerProps>) => (
+ <Flex
+ flex="0 0 auto"
+ align="center"
+ justify="center"
+ w="1.5rem"
+ h="1.5rem"
+ bdrs="lg"
+ c="text-primary-inverse"
+ bg={isError ? "feedback-negative" : "feedback-positive"}
+ >
+ {children}
+ </Flex>
+);
diff --git a/frontend/src/metabase/status/components/StatusLarge/index.ts b/frontend/src/metabase/status/components/StatusLarge/index.ts
index e233fec3751..1f530cd55f9 100644
--- a/frontend/src/metabase/status/components/StatusLarge/index.ts
+++ b/frontend/src/metabase/status/components/StatusLarge/index.ts
@@ -1,2 +1 @@
-// eslint-disable-next-line import/no-default-export -- deprecated usage
-export { default } from "./StatusLarge";
+export * from "./StatusLarge";
diff --git a/frontend/src/metabase/status/components/StatusListing/StatusListing.styled.tsx b/frontend/src/metabase/status/components/StatusListing/StatusListing.styled.tsx
deleted file mode 100644
index b865fcaf7de..00000000000
--- a/frontend/src/metabase/status/components/StatusListing/StatusListing.styled.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-// eslint-disable-next-line eslint-js/no-restricted-imports
-import styled from "@emotion/styled";
-
-export const StatusListingRoot = styled.div`
- position: fixed;
- right: 1.5rem;
- bottom: 1.5rem;
- z-index: 2;
-`;
diff --git a/frontend/src/metabase/status/components/StatusListing/StatusListing.tsx b/frontend/src/metabase/status/components/StatusListing/StatusListing.tsx
index 54c4dae7dfd..4995b4182fb 100644
--- a/frontend/src/metabase/status/components/StatusListing/StatusListing.tsx
+++ b/frontend/src/metabase/status/components/StatusListing/StatusListing.tsx
@@ -1,6 +1,7 @@
import { useBeforeUnload } from "react-use";
import { t } from "ttag";
+import CS from "metabase/css/core/index.css";
import { getUserIsAdmin } from "metabase/current-user";
import {
PLUGIN_AUDIT,
@@ -11,13 +12,12 @@ import {
import { useSelector } from "metabase/redux";
import { hasActiveUploads } from "metabase/redux/uploads";
import { useCheckActiveDownloadsBeforeUnload } from "metabase/status/hooks/use-check-active-downloads-before-unload";
+import { Box } from "metabase/ui";
import { DatabaseStatus } from "../DatabaseStatus";
import { DownloadsStatus } from "../DownloadsStatus";
import { FileUploadStatus } from "../FileUploadStatus";
-import { StatusListingRoot } from "./StatusListing.styled";
-
export const StatusListing = () => {
const isAdmin = useSelector(getUserIsAdmin);
const { progressModal } = PLUGIN_REMOTE_SYNC.useSyncStatus();
@@ -33,14 +33,20 @@ export const StatusListing = () => {
return (
<>
- <StatusListingRoot data-testid="status-root-container">
+ <Box
+ className={CS.z2}
+ pos="fixed"
+ right="1.5rem"
+ bottom="1.5rem"
+ data-testid="status-root-container"
+ >
{isAdmin && <DatabaseStatus />}
{isAdmin && <PLUGIN_REPLACEMENT.SourceReplacementStatus />}
<FileUploadStatus />
<PLUGIN_AUDIT.AnalyticsExportStatus />
<DownloadsStatus />
{isAdmin && <PLUGIN_UPLOAD_MANAGEMENT.GdriveSyncStatus />}
- </StatusListingRoot>
+ </Box>
{progressModal}
</>
);
diff --git a/frontend/src/metabase/ui/components/buttons/ActionIcon/ActionIcon.module.css b/frontend/src/metabase/ui/components/buttons/ActionIcon/ActionIcon.module.css
index 19877cda0bc..256cfafb961 100644
--- a/frontend/src/metabase/ui/components/buttons/ActionIcon/ActionIcon.module.css
+++ b/frontend/src/metabase/ui/components/buttons/ActionIcon/ActionIcon.module.css
@@ -13,6 +13,15 @@
}
}
+ &[data-variant="static"] {
+ color: var(--mb-color-text-disabled);
+ background-color: transparent;
+
+ &:active {
+ transform: none;
+ }
+ }
+
/* To be able to seamlessly support color property across variants we need
to implement variantColorResolver. Same thing is pointed out in Button component. */
&[data-variant="info"] {