Skip to content

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

fix: custom brand color not consistently applied on Enterprise UI elements (#68484)

Maksym Yakubychfd90d13ae3c6
diff --git a/e2e/test/scenarios/onboarding/auth/sso.cy.spec.js b/e2e/test/scenarios/onboarding/auth/sso.cy.spec.js
index fcc10c6245f..77f2ec4a0a5 100644
--- a/e2e/test/scenarios/onboarding/auth/sso.cy.spec.js
+++ b/e2e/test/scenarios/onboarding/auth/sso.cy.spec.js
@@ -54,7 +54,7 @@ describe("scenarios > auth > signin > SSO", () => {
cy.findByLabelText("Password").type("123");
cy.button("Sign in").click();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
- cy.contains("Password: did not match stored password");
+ cy.contains("did not match stored password");
});
it("should pass `redirect` search params from Google button screen to email/password screen (metabase#16216)", () => {
diff --git a/frontend/src/metabase/auth/components/LoginForm/LoginForm.tsx b/frontend/src/metabase/auth/components/LoginForm/LoginForm.tsx
index 4aab98a4443..f4133956131 100644
--- a/frontend/src/metabase/auth/components/LoginForm/LoginForm.tsx
+++ b/frontend/src/metabase/auth/components/LoginForm/LoginForm.tsx
@@ -2,10 +2,14 @@ import { useMemo } from "react";
import { t } from "ttag";
import * as Yup from "yup";
-import FormErrorMessage from "metabase/common/components/FormErrorMessage";
-import FormInput from "metabase/common/components/FormInput";
-import FormSubmitButton from "metabase/common/components/FormSubmitButton";
-import { Form, FormCheckbox, FormProvider } from "metabase/forms";
+import {
+ Form,
+ FormCheckbox,
+ FormErrorMessage,
+ FormProvider,
+ FormSubmitButton,
+ FormTextInput,
+} from "metabase/forms";
import * as Errors from "metabase/lib/errors";
import type { LoginData } from "../../types";
@@ -56,26 +60,28 @@ export const LoginForm = ({
onSubmit={onSubmit}
>
<Form>
- <FormInput
+ <FormTextInput
name="username"
- title={
+ label={
isLdapEnabled ? t`Username or email address` : t`Email address`
}
type={isLdapEnabled ? "input" : "email"}
placeholder="[email protected]"
autoFocus
+ mb="1.25rem"
/>
- <FormInput
+ <FormTextInput
name="password"
- title={t`Password`}
+ label={t`Password`}
type="password"
- placeholder={t`Shhh...`}
+ placeholder="Shhh..."
+ mb="1.25rem"
/>
{!hasSessionCookies && (
<FormCheckbox name="remember" label={t`Remember me`} mb="1.25rem" />
)}
- <FormSubmitButton title={t`Sign in`} primary fullWidth />
- <FormErrorMessage />
+ <FormSubmitButton label={t`Sign in`} variant="filled" w="100%" />
+ <FormErrorMessage mt="1rem" />
</Form>
</FormProvider>
);
diff --git a/frontend/src/metabase/browse/databases/BrowseDatabases.tsx b/frontend/src/metabase/browse/databases/BrowseDatabases.tsx
index 74b86df10d5..8111b9a787f 100644
--- a/frontend/src/metabase/browse/databases/BrowseDatabases.tsx
+++ b/frontend/src/metabase/browse/databases/BrowseDatabases.tsx
@@ -68,7 +68,6 @@ export const BrowseDatabases = () => {
title={database.name}
icon="database"
size="lg"
- iconColor="accent2" // can we change this? - Yes we can
/>
))}
{isAdmin && <AddDatabaseCard />}
diff --git a/frontend/src/metabase/databases/components/DatabaseHostnameWithProviderField/ProviderIcon.tsx b/frontend/src/metabase/databases/components/DatabaseHostnameWithProviderField/ProviderIcon.tsx
index cde9049e585..8eb6d8ecd03 100644
--- a/frontend/src/metabase/databases/components/DatabaseHostnameWithProviderField/ProviderIcon.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseHostnameWithProviderField/ProviderIcon.tsx
@@ -25,9 +25,7 @@ export function ProviderIcon({
provider: DatabaseProviderName | null;
}) {
if (!provider) {
- return (
- <Icon name="database" size={ICON_SIZE} c="icon-primary" opacity={0.25} />
- );
+ return <Icon name="database" size={ICON_SIZE} c="icon-primary" />;
}
const image = match(provider)
diff --git a/frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.module.css b/frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.module.css
index 2541ab45b7c..ab063326177 100644
--- a/frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.module.css
+++ b/frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.module.css
@@ -1,8 +1,3 @@
-.greetingRoot {
- display: flex;
- align-items: center;
-}
-
.greetingLogoContainer {
position: relative;
width: 4rem;
diff --git a/frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.tsx b/frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.tsx
index 0de14164381..5e42cb6fa98 100644
--- a/frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.tsx
+++ b/frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.tsx
@@ -7,7 +7,7 @@ import { MetabotLogo } from "metabase/common/components/MetabotLogo";
import animationStyles from "metabase/css/core/animation.module.css";
import { useSelector } from "metabase/lib/redux";
import { getUser } from "metabase/selectors/user";
-import { Tooltip } from "metabase/ui";
+import { Flex, Tooltip } from "metabase/ui";
import { getHasMetabotLogo } from "../../selectors";
@@ -20,7 +20,7 @@ export const HomeGreeting = (): JSX.Element => {
const message = useMemo(() => getMessage(name), [name]);
return (
- <div className={S.greetingRoot}>
+ <Flex align="center">
{showLogo && <MetabotGreeting />}
<span
data-testid="greeting-message"
@@ -28,7 +28,7 @@ export const HomeGreeting = (): JSX.Element => {
>
{message}
</span>
- </div>
+ </Flex>
);
};
diff --git a/frontend/src/metabase/home/components/HomeLayout/HomeLayout.styled.tsx b/frontend/src/metabase/home/components/HomeLayout/HomeLayout.styled.tsx
deleted file mode 100644
index 5c8abe658ee..00000000000
--- a/frontend/src/metabase/home/components/HomeLayout/HomeLayout.styled.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-// eslint-disable-next-line no-restricted-imports
-import styled from "@emotion/styled";
-
-import Button from "metabase/common/components/Button/Button";
-import { lighten } from "metabase/lib/colors";
-import {
- breakpointMinExtraLarge,
- breakpointMinLarge,
- breakpointMinMedium,
-} from "metabase/styled-components/theme";
-
-export const LayoutRoot = styled.div`
- position: relative;
- min-height: 100%;
- padding: 1rem;
- background-color: var(--mb-color-background-secondary);
-
- ${breakpointMinMedium} {
- padding: 3rem 4rem;
- }
-
- ${breakpointMinLarge} {
- padding: 4rem 7rem 2rem;
- }
-
- ${breakpointMinExtraLarge} {
- padding: 10rem 15rem 4rem;
- }
-`;
-
-export const LayoutBody = styled.div`
- position: relative;
- margin-top: 2.5rem;
-
- ${breakpointMinMedium} {
- margin-top: 4rem;
- }
-
- ${breakpointMinLarge} {
- margin-top: 6rem;
- }
-`;
-
-export const LayoutIllustration = styled.div<{
- backgroundImageSrc: string;
-}>`
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-image: ${({ backgroundImageSrc }) =>
- `url("${backgroundImageSrc}")`};
- background-size: 100% auto;
- background-repeat: no-repeat;
- background-position: bottom;
-`;
-
-export const LayoutEditButton = styled(Button)`
- position: absolute;
- top: 0.75rem;
- right: 1rem;
-
- &:hover {
- color: var(--mb-color-brand);
- background: ${() => lighten("brand", 0.6)};
- }
-`;
diff --git a/frontend/src/metabase/home/components/HomeLayout/HomeLayout.tsx b/frontend/src/metabase/home/components/HomeLayout/HomeLayout.tsx
index 1ba528f70f9..71ccb3cbd87 100644
--- a/frontend/src/metabase/home/components/HomeLayout/HomeLayout.tsx
+++ b/frontend/src/metabase/home/components/HomeLayout/HomeLayout.tsx
@@ -8,18 +8,11 @@ import { EmbeddingHubHomePage } from "metabase/embedding/embedding-hub";
import { useSelector } from "metabase/lib/redux";
import { getUser, getUserIsAdmin } from "metabase/selectors/user";
import { getLandingPageIllustration } from "metabase/selectors/whitelabel";
-import { Tooltip } from "metabase/ui";
+import { Box, Button, Icon, Tooltip } from "metabase/ui";
import { CustomHomePageModal } from "../CustomHomePageModal";
import { HomeGreeting } from "../HomeGreeting";
-import {
- LayoutBody,
- LayoutEditButton,
- LayoutIllustration,
- LayoutRoot,
-} from "./HomeLayout.styled";
-
interface HomeLayoutProps {
children?: ReactNode;
}
@@ -42,33 +35,63 @@ export const HomeLayout = ({ children }: HomeLayoutProps): ReactNode => {
}
return (
- <LayoutRoot data-testid="home-page">
+ <Box
+ data-testid="home-page"
+ pos="relative"
+ p={{
+ base: "1rem",
+ md: "3rem 4rem",
+ lg: "4rem 7rem 2rem",
+ xl: "10rem 15rem 4rem",
+ }}
+ mih="100%"
+ bg="background-secondary"
+ >
{landingPageIllustration &&
(landingPageIllustration.isDefault ? (
<LighthouseIllustration />
) : (
- <LayoutIllustration
+ <Box
data-testid="landing-page-illustration"
- backgroundImageSrc={landingPageIllustration.src}
+ pos="absolute"
+ inset={0}
+ bgsz="100% auto"
+ bgr="no-repeat"
+ bgp="bottom"
+ style={{
+ backgroundImage: `url(${landingPageIllustration.src})`,
+ }}
/>
))}
<HomeGreeting />
{isAdmin && (
<Tooltip label={t`Pick a dashboard to serve as the homepage`}>
- <LayoutEditButton
- icon="pencil"
- borderless
+ <Button
+ pos="absolute"
+ top="0.75rem"
+ right="1rem"
+ variant="subtle"
+ leftSection={<Icon name="pencil" />}
onClick={() => setShowModal(true)}
>
{t`Customize`}
- </LayoutEditButton>
+ </Button>
</Tooltip>
)}
- <LayoutBody>{children}</LayoutBody>
+ <Box
+ pos="relative"
+ mt={{
+ base: "2.5rem",
+ md: "4rem",
+ lg: "6rem",
+ }}
+ >
+ {children}
+ </Box>
<CustomHomePageModal
isOpen={showModal}
onClose={() => setShowModal(false)}
/>
- </LayoutRoot>
+ </Box>
);
};
diff --git a/frontend/src/metabase/status/components/StatusSmall/StatusSmall.module.css b/frontend/src/metabase/status/components/StatusSmall/StatusSmall.module.css
new file mode 100644
index 00000000000..537293adbed
--- /dev/null
+++ b/frontend/src/metabase/status/components/StatusSmall/StatusSmall.module.css
@@ -0,0 +1,37 @@
+.Root {
+ position: relative;
+ width: 3rem;
+ height: 3rem;
+
+ --border-color: var(--mb-color-brand-light);
+ --background-color: transparent;
+ --icon-color: var(--mb-color-brand);
+}
+
+.Root[data-status="complete"] {
+ --border-color: var(--mb-color-brand);
+ --background-color: var(--mb-color-success);
+ --icon-color: var(--mb-color-text-primary-inverse);
+}
+
+.Root[data-status="loading"] {
+ --background-color: var(--mb-color-error);
+ --icon-color: var(--mb-color-text-primary-inverse);
+}
+
+.StatusContainer {
+ width: 100%;
+ height: 100%;
+ color: var(--icon-color);
+ border: 0.375rem solid var(--border-color);
+ border-radius: 50%;
+ background-color: var(--mb-color-brand-light);
+ box-shadow: 0 1px 12px var(--mb-color-shadow);
+}
+
+.StatusIconContainer {
+ width: 1.5rem;
+ height: 1.5rem;
+ border-radius: 50%;
+ background-color: var(--background-color);
+}
diff --git a/frontend/src/metabase/status/components/StatusSmall/StatusSmall.styled.tsx b/frontend/src/metabase/status/components/StatusSmall/StatusSmall.styled.tsx
deleted file mode 100644
index 0c60937df7c..00000000000
--- a/frontend/src/metabase/status/components/StatusSmall/StatusSmall.styled.tsx
+++ /dev/null
@@ -1,92 +0,0 @@
-// eslint-disable-next-line no-restricted-imports
-import styled from "@emotion/styled";
-
-import LoadingSpinner from "metabase/common/components/LoadingSpinner";
-import { lighten } from "metabase/lib/colors";
-import { Icon } from "metabase/ui";
-import { color } from "metabase/ui/utils/colors";
-import type { InitialSyncStatus } from "metabase-types/api";
-
-interface Props {
- status: InitialSyncStatus;
-}
-
-const getIconColor = ({ status }: Props): string => {
- switch (status) {
- case "incomplete":
- return color("brand");
- default:
- return color("text-primary-inverse");
- }
-};
-
-const getIconSize = ({ status }: Props): string => {
- switch (status) {
- case "incomplete":
- return "0.875rem";
- default:
- return "0.75rem";
- }
-};
-
-const getBorderColor = ({ status }: Props): string => {
- switch (status) {
- case "complete":
- return color("brand");
- default:
- return lighten("brand", 0.5);
- }
-};
-
-const getBackgroundColor = ({ status }: Props): string => {
- switch (status) {
- case "incomplete":
- return "transparent";
- case "complete":
- return color("success");
- case "aborted":
- return color("error");
- }
-};
-
-export const StatusRoot = styled.div`
- position: relative;
- width: 3rem;
- height: 3rem;
- cursor: pointer;
-`;
-
-export const StatusContainer = styled.div<Props>`
- display: flex;
- justify-content: center;
- align-items: center;
- width: 100%;
- height: 100%;
- color: ${getIconColor};
- border: 0.25rem solid ${getBorderColor};
- border-radius: 50%;
- background-color: ${() => lighten("brand", 0.6)};
- box-shadow: 0 1px 12px var(--mb-color-shadow);
-`;
-
-export const StatusIconContainer = styled.div`
- display: flex;
- justify-content: center;
- align-items: center;
- width: 1.5rem;
- height: 1.5rem;
- border-radius: 50%;
- background-color: ${getBackgroundColor};
-`;
-
-export const StatusIcon = styled(Icon)`
- width: ${getIconSize};
- height: ${getIconSize};
-`;
-
-export const StatusSpinner = styled(LoadingSpinner)`
- position: absolute;
- top: 0;
- left: 0;
- color: var(--mb-color-brand);
-`;
diff --git a/frontend/src/metabase/status/components/StatusSmall/StatusSmall.tsx b/frontend/src/metabase/status/components/StatusSmall/StatusSmall.tsx
index 55c7de95262..520e227212e 100644
--- a/frontend/src/metabase/status/components/StatusSmall/StatusSmall.tsx
+++ b/frontend/src/metabase/status/components/StatusSmall/StatusSmall.tsx
@@ -1,14 +1,8 @@
import type { IconName } from "metabase/ui";
-import { Tooltip } from "metabase/ui";
+import { Flex, Icon, Loader, Tooltip, UnstyledButton } from "metabase/ui";
import type { InitialSyncStatus } from "metabase-types/api";
-import {
- StatusContainer,
- StatusIcon,
- StatusIconContainer,
- StatusRoot,
- StatusSpinner,
-} from "./StatusSmall.styled";
+import Styles from "./StatusSmall.module.css";
export interface StatusSmallProps {
status: InitialSyncStatus;
@@ -27,14 +21,28 @@ const StatusSmall = ({
}: StatusSmallProps): JSX.Element => {
return (
<Tooltip label={statusLabel}>
- <StatusRoot role="status" aria-label={statusLabel} onClick={onExpand}>
- <StatusContainer status={status}>
- <StatusIconContainer status={status}>
- <StatusIcon status={status} name={icon} />
- </StatusIconContainer>
- </StatusContainer>
- {hasSpinner && <StatusSpinner size={48} />}
- </StatusRoot>
+ <UnstyledButton
+ className={Styles.Root}
+ role="status"
+ aria-label={statusLabel}
+ data-status={status}
+ onClick={onExpand}
+ >
+ <Flex
+ align="center"
+ justify="center"
+ className={Styles.StatusContainer}
+ >
+ <Flex
+ align="center"
+ justify="center"
+ className={Styles.StatusIconContainer}
+ >
+ <Icon width={"sm"} name={icon} />
+ </Flex>
+ </Flex>
+ {hasSpinner && <Loader pos="absolute" inset={0} size={48} />}
+ </UnstyledButton>
</Tooltip>
);
};
diff --git a/frontend/src/metabase/ui/components/feedback/Loader/Loader.tsx b/frontend/src/metabase/ui/components/feedback/Loader/Loader.tsx
index 6feb6b8d672..911f2865a37 100644
--- a/frontend/src/metabase/ui/components/feedback/Loader/Loader.tsx
+++ b/frontend/src/metabase/ui/components/feedback/Loader/Loader.tsx
@@ -29,12 +29,12 @@ export const Loader = ({ size = "md", label, ...props }: LoaderProps) => {
return label ? (
<Stack justify="center" align="center" gap="sm" mt="xl">
- <MantineLoader {...props} size={getSize(SIZES[size])} />
+ <MantineLoader {...props} size={getSize(SIZES[size] ?? size)} />
<Text c="text-tertiary" size="xl">
{label}
</Text>
</Stack>
) : (
- <MantineLoader {...props} size={getSize(SIZES[size])} />
+ <MantineLoader {...props} size={getSize(SIZES[size] ?? size)} />
);
};