Skip to content

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

fix(embed-js): Fix EmbedJS/SDK dashboard styles to properly display the EmbedJS branding footer (#68090)

Timofey Kachalov2a70fd1794f7
diff --git a/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.module.css b/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.module.css
new file mode 100644
index 00000000000..d41bbf66067
--- /dev/null
+++ b/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.module.css
@@ -0,0 +1,4 @@
+.SdkDashboardStyleWrapper {
+ min-height: 100vh;
+ background-color: var(--mb-color-bg-dashboard);
+}
diff --git a/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.tsx b/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.tsx
index dbd0fffc855..7bd56586e15 100644
--- a/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboardStyleWrapper.tsx
@@ -6,6 +6,8 @@ import CS from "metabase/css/core/index.css";
import { useDashboardContext } from "metabase/dashboard/context";
import { Flex } from "metabase/ui";
+import SdkDashboardStyleWrapperS from "./SdkDashboardStyleWrapper.module.css";
+
export const SdkDashboardStyledWrapper = forwardRef(
function SdkDashboardStyledWrapperInner(
{ className, style, children }: PropsWithChildren<CommonStylingProps>,
@@ -16,12 +18,12 @@ export const SdkDashboardStyledWrapper = forwardRef(
direction="column"
justify="flex-start"
align="stretch"
- className={cx(className, CS.overflowAuto)}
- style={{
- minHeight: "100vh",
- backgroundColor: "var(--mb-color-bg-dashboard)",
- ...style,
- }}
+ className={cx(
+ className,
+ SdkDashboardStyleWrapperS.SdkDashboardStyleWrapper,
+ CS.overflowAuto,
+ )}
+ style={style}
ref={fullscreenRef}
>
{children}
diff --git a/frontend/src/metabase/embedding/embedding-iframe-sdk/components/SdkIframeEmbedRoute.module.css b/frontend/src/metabase/embedding/embedding-iframe-sdk/components/SdkIframeEmbedRoute.module.css
new file mode 100644
index 00000000000..ea9b8453ed5
--- /dev/null
+++ b/frontend/src/metabase/embedding/embedding-iframe-sdk/components/SdkIframeEmbedRoute.module.css
@@ -0,0 +1,15 @@
+.Container {
+ display: grid;
+ width: 100%;
+ grid-template-columns: 1fr;
+ grid-template-rows: 1fr;
+}
+
+.Container:has(.BrandingFooter) {
+ grid-template-rows: 1fr auto;
+}
+
+.Dashboard {
+ height: 100%;
+ min-height: unset;
+}
diff --git a/frontend/src/metabase/embedding/embedding-iframe-sdk/components/SdkIframeEmbedRoute.tsx b/frontend/src/metabase/embedding/embedding-iframe-sdk/components/SdkIframeEmbedRoute.tsx
index c8375485e97..4963da611e2 100644
--- a/frontend/src/metabase/embedding/embedding-iframe-sdk/components/SdkIframeEmbedRoute.tsx
+++ b/frontend/src/metabase/embedding/embedding-iframe-sdk/components/SdkIframeEmbedRoute.tsx
@@ -31,6 +31,7 @@ import { useSdkIframeEmbedEventBus } from "../hooks/use-sdk-iframe-embed-event-b
import type { SdkIframeEmbedSettings } from "../types/embed";
import { MetabaseBrowser } from "./MetabaseBrowser";
+import SdkIframeEmbedRouteS from "./SdkIframeEmbedRoute.module.css";
import {
SdkIframeApiKeyInProductionError,
SdkIframeExistingUserSessionInProductionError,
@@ -99,11 +100,8 @@ export const SdkIframeEmbedRoute = () => {
>
<Stack
mih="100vh"
+ className={SdkIframeEmbedRouteS.Container}
style={{
- display: "grid",
- width: "100%",
- gridTemplateColumns: "1fr",
- gridTemplateRows: "1fr auto",
backgroundColor: adjustedTheme?.colors?.background,
}}
>
@@ -171,6 +169,7 @@ const SdkIframeEmbedView = ({
return (
<StaticDashboard
key={rerenderKey}
+ className={SdkIframeEmbedRouteS.Dashboard}
{...entityProps}
withTitle={settings.withTitle}
withDownloads={settings.withDownloads}
@@ -190,6 +189,7 @@ const SdkIframeEmbedView = ({
(settings) => (
<InteractiveDashboard
key={rerenderKey}
+ className={SdkIframeEmbedRouteS.Dashboard}
dashboardId={settings.dashboardId ?? null}
token={settings.token}
withTitle={settings.withTitle}
@@ -285,7 +285,9 @@ const EmbedBrandingFooter = () => {
}
return (
- <PublicComponentStylesWrapper>
+ <PublicComponentStylesWrapper
+ className={SdkIframeEmbedRouteS.BrandingFooter}
+ >
<EmbeddingFooter variant="default" hasEmbedBranding />
</PublicComponentStylesWrapper>
);