Skip to content

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

Migrate database engine warning and section field from Emotion to Mantine (#74997)

Andrei Chernykh0de49b9ef724
diff --git a/frontend/src/metabase/databases/components/DatabaseEngineWarning/DatabaseEngineWarning.styled.tsx b/frontend/src/metabase/databases/components/DatabaseEngineWarning/DatabaseEngineWarning.styled.tsx
deleted file mode 100644
index 0acb3622bd2..00000000000
--- a/frontend/src/metabase/databases/components/DatabaseEngineWarning/DatabaseEngineWarning.styled.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-// eslint-disable-next-line no-restricted-imports
-import styled from "@emotion/styled";
-
-import { Alert } from "metabase/common/components/Alert";
-
-export const Warning = styled(Alert)`
- margin-bottom: 2rem;
-`;
-
-export const WarningLink = styled.a`
- color: var(--mb-color-brand);
- cursor: pointer;
- font-weight: bold;
-`;
diff --git a/frontend/src/metabase/databases/components/DatabaseEngineWarning/DatabaseEngineWarning.tsx b/frontend/src/metabase/databases/components/DatabaseEngineWarning/DatabaseEngineWarning.tsx
index 3aec612cd43..6da761b3c46 100644
--- a/frontend/src/metabase/databases/components/DatabaseEngineWarning/DatabaseEngineWarning.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseEngineWarning/DatabaseEngineWarning.tsx
@@ -1,10 +1,10 @@
import { jt, t } from "ttag";
import _ from "underscore";
+import { Alert } from "metabase/common/components/Alert";
+import { Anchor, Box } from "metabase/ui";
import type { Engine } from "metabase-types/api";
-import { Warning, WarningLink } from "./DatabaseEngineWarning.styled";
-
export interface DatabaseEngineWarningProps {
engineKey?: string;
engines: Record<string, Engine>;
@@ -69,14 +69,22 @@ interface NewEngineWarningProps {
}
const NewEngineWarning = ({ engineName, onChange }: NewEngineWarningProps) => (
- <Warning>
- {t`This driver will be removed in a future release.`}{" "}
- {jt`We recommend you upgrade to the ${(
- <WarningLink key="link" onClick={onChange}>
- {t`new ${engineName} driver`}
- </WarningLink>
- )}.`}
- </Warning>
+ <Box mb="xl">
+ <Alert>
+ {t`This driver will be removed in a future release.`}{" "}
+ {jt`We recommend you upgrade to the ${(
+ <Anchor
+ component="button"
+ key="link"
+ c="brand"
+ fw={700}
+ onClick={onChange}
+ >
+ {t`new ${engineName} driver`}
+ </Anchor>
+ )}.`}
+ </Alert>
+ </Box>
);
interface OldEngineWarningProps {
@@ -85,22 +93,32 @@ interface OldEngineWarningProps {
}
const OldEngineWarning = ({ engineName, onChange }: OldEngineWarningProps) => (
- <Warning>
- {t`This is our new ${engineName} driver.`}{" "}
- {t`The old driver has been deprecated and will be removed in a future release.`}{" "}
- {jt`If you really need to use it, you can ${(
- <WarningLink key="link" onClick={onChange}>
- {t`find it here`}
- </WarningLink>
- )}.`}
- </Warning>
+ <Box mb="xl">
+ <Alert>
+ {t`This is our new ${engineName} driver.`}{" "}
+ {t`The old driver has been deprecated and will be removed in a future release.`}{" "}
+ {jt`If you really need to use it, you can ${(
+ <Anchor
+ component="button"
+ key="link"
+ c="brand"
+ fw={700}
+ onClick={onChange}
+ >
+ {t`find it here`}
+ </Anchor>
+ )}.`}
+ </Alert>
+ </Box>
);
const CommunityEngineWarning = () => (
- <Warning icon="info">
- {/* eslint-disable-next-line metabase/no-literal-metabase-strings -- Metabase settings */}
- {t`This is a community-developed driver and not supported by Metabase. `}
- </Warning>
+ <Box mb="xl">
+ <Alert icon="info">
+ {/* eslint-disable-next-line metabase/no-literal-metabase-strings -- Metabase settings */}
+ {t`This is a community-developed driver and not supported by Metabase. `}
+ </Alert>
+ </Box>
);
// eslint-disable-next-line import/no-default-export -- deprecated usage
diff --git a/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.module.css b/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.module.css
new file mode 100644
index 00000000000..a5e8b82d2bd
--- /dev/null
+++ b/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.module.css
@@ -0,0 +1,10 @@
+.sectionButton {
+ color: var(--mb-color-brand);
+ padding: 0;
+ border: none;
+ border-radius: 0;
+
+ &:hover {
+ background-color: transparent;
+ }
+}
diff --git a/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.styled.tsx b/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.styled.tsx
deleted file mode 100644
index b04829daef8..00000000000
--- a/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.styled.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-// eslint-disable-next-line no-restricted-imports
-import styled from "@emotion/styled";
-
-import { Button } from "metabase/common/components/Button";
-
-export const SectionButton = styled(Button)`
- color: var(--mb-color-brand);
- padding: 0;
- border: none;
- border-radius: 0;
-
- &:hover {
- background-color: transparent;
- }
-`;
diff --git a/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.tsx b/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.tsx
index e2aead053d9..274515f175f 100644
--- a/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.tsx
@@ -2,9 +2,10 @@ import { useField } from "formik";
import { useCallback } from "react";
import { t } from "ttag";
+import { Button } from "metabase/common/components/Button";
import { FormField } from "metabase/common/components/FormField";
-import { SectionButton } from "./DatabaseSectionField.styled";
+import S from "./DatabaseSectionField.module.css";
export interface DatabaseSectionFieldProps {
name: string;
@@ -21,13 +22,14 @@ const DatabaseSectionField = ({
return (
<FormField>
- <SectionButton
+ <Button
+ className={S.sectionButton}
type="button"
iconRight={value ? "chevronup" : "chevrondown"}
onClick={handleClick}
>
{value ? t`Hide advanced options` : t`Show advanced options`}
- </SectionButton>
+ </Button>
</FormField>
);
};