Skip to content

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

Migrate the embed homepage images off Emotion (#83863)

Andrei Chernykh35fb4a207975
diff --git a/frontend/src/metabase/home/components/EmbedHomepage/EmbedHomepage.module.css b/frontend/src/metabase/home/components/EmbedHomepage/EmbedHomepage.module.css
new file mode 100644
index 00000000000..2fab2b91c23
--- /dev/null
+++ b/frontend/src/metabase/home/components/EmbedHomepage/EmbedHomepage.module.css
@@ -0,0 +1,4 @@
+.border {
+ border: 1px solid var(--mb-color-border-neutral);
+ border-radius: 0.5rem;
+}
diff --git a/frontend/src/metabase/home/components/EmbedHomepage/EmbedJsContent.tsx b/frontend/src/metabase/home/components/EmbedHomepage/EmbedJsContent.tsx
index 6c88f0ffec3..4d0f5b768be 100644
--- a/frontend/src/metabase/home/components/EmbedHomepage/EmbedJsContent.tsx
+++ b/frontend/src/metabase/home/components/EmbedHomepage/EmbedJsContent.tsx
@@ -1,5 +1,3 @@
-// eslint-disable-next-line eslint-js/no-restricted-imports
-import styled from "@emotion/styled";
import { match } from "ts-pattern";
import { t } from "ttag";
@@ -8,6 +6,8 @@ import { ExternalLink } from "metabase/common/components/ExternalLink";
import { Link } from "metabase/common/components/Link";
import { Box, Button, Group, Text } from "metabase/ui";
+import S from "./EmbedHomepage.module.css";
+
type EmbedJsContentProps = {
embedJsDocsUrl: string;
showImage?: boolean;
@@ -48,9 +48,13 @@ export const EmbedJsContent = ({
{t`A JavaScript library built on top of Metabase’s modular embedding SDK that lets you embed individual components (charts, dashboards, query builder) using plain JS — no React setup required. You get per-component controls like drill-through, parameters, downloads, theming.`}
</Text>
{showImage && (
- <EmbedJsImage
+ <Box
+ component="img"
+ className={S.border}
src={embedJsExampleImage}
alt="Modular embedding example"
+ w="100%"
+ mb="lg"
/>
)}
<Group gap="lg">
@@ -65,10 +69,3 @@ export const EmbedJsContent = ({
</Box>
);
};
-
-const EmbedJsImage = styled.img`
- width: 100%;
- margin-bottom: 1rem;
- border-radius: 8px;
- border: 1px solid ${({ theme }) => theme.colors["border-neutral"]};
-`;
diff --git a/frontend/src/metabase/home/components/EmbedHomepage/StaticEmbedContent.tsx b/frontend/src/metabase/home/components/EmbedHomepage/StaticEmbedContent.tsx
index f155c441922..3af0e75c81f 100644
--- a/frontend/src/metabase/home/components/EmbedHomepage/StaticEmbedContent.tsx
+++ b/frontend/src/metabase/home/components/EmbedHomepage/StaticEmbedContent.tsx
@@ -1,5 +1,3 @@
-// eslint-disable-next-line eslint-js/no-restricted-imports
-import styled from "@emotion/styled";
import { t } from "ttag";
import staticEmbeddingExampleImage from "assets/img/static-embedding-example.png";
@@ -7,6 +5,7 @@ import { ExternalLink } from "metabase/common/components/ExternalLink";
import { Link } from "metabase/common/components/Link";
import { Box, Button, Group, Text } from "metabase/ui";
+import S from "./EmbedHomepage.module.css";
import { trackEmbeddingHomepageExampleDashboardClick } from "./analytics";
type StaticEmbedContentProps = {
@@ -33,9 +32,13 @@ export const StaticEmbedContent = ({
{t`Embed a dashboard in a 'Powered by Metabase' iframe with interactivity limited to filters and tooltips, and a few customization options. The iframe loads a Metabase URL secured with a signed JSON Web Token (JWT). Appears with "Powered by Metabase", on Open Source and Starter plans, with the option to remove on Pro and Enterprise. As the simplest form of embedding, you can add a dashboard into your app in a few minutes with just a snippet.`}
</Text>
{showImage && (
- <StaticEmbedImage
+ <Box
+ component="img"
+ className={S.border}
src={staticEmbeddingExampleImage}
alt="Static embedding example"
+ w="100%"
+ mb="lg"
/>
)}
<Group gap="lg">
@@ -53,10 +56,3 @@ export const StaticEmbedContent = ({
</Group>
</Box>
);
-
-const StaticEmbedImage = styled.img`
- width: 100%;
- margin-bottom: 1rem;
- border-radius: 8px;
- border: 1px solid ${({ theme }) => theme.colors["border-neutral"]};
-`;