Skip to content

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

Uxw 3675 emotion css mantine auth login (#84065)

Nick Fitzpatrickf4077cf0ffa4
diff --git a/frontend/src/metabase/auth/components/AuthLayout/AuthLayout.styled.tsx b/frontend/src/metabase/auth/components/AuthLayout/AuthLayout.styled.tsx
deleted file mode 100644
index f89cc64f932..00000000000
--- a/frontend/src/metabase/auth/components/AuthLayout/AuthLayout.styled.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-// eslint-disable-next-line eslint-js/no-restricted-imports
-import styled from "@emotion/styled";
-
-import { breakpointMinSmall } from "metabase/styled-components/theme";
-
-export const LayoutRoot = styled.div`
- position: relative;
- min-height: 100vh;
- background-color: var(--mb-color-background_page-secondary);
-`;
-
-export const LayoutBody = styled.div`
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- position: relative;
- padding: 1.5rem 1rem 3rem;
- min-height: 100vh;
-`;
-
-export const LayoutCard = styled.div`
- width: 100%;
- margin-top: 1.5rem;
- padding: 2.5rem 1.5rem;
- background-color: var(--mb-color-background_page-primary);
- box-shadow: 0 1px 15px var(--mb-color-shadow-default);
- border-radius: 6px;
-
- ${breakpointMinSmall} {
- width: 30.875rem;
- padding: 2.5rem 3.5rem;
- }
-`;
-
-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: right bottom;
-`;
diff --git a/frontend/src/metabase/auth/components/AuthLayout/AuthLayout.tsx b/frontend/src/metabase/auth/components/AuthLayout/AuthLayout.tsx
index 144f2cdbb14..57cbea7bb60 100644
--- a/frontend/src/metabase/auth/components/AuthLayout/AuthLayout.tsx
+++ b/frontend/src/metabase/auth/components/AuthLayout/AuthLayout.tsx
@@ -4,13 +4,8 @@ import { LighthouseIllustration } from "metabase/common/components/LighthouseIll
import { LogoIcon } from "metabase/common/components/LogoIcon";
import { useSelector } from "metabase/redux";
import { getLoginPageIllustration } from "metabase/selectors/whitelabel";
+import { Box, Card, Stack } from "metabase/ui";
-import {
- LayoutBody,
- LayoutCard,
- LayoutIllustration,
- LayoutRoot,
-} from "./AuthLayout.styled";
interface AuthLayoutProps {
children?: ReactNode;
}
@@ -19,20 +14,42 @@ export const AuthLayout = ({ children }: AuthLayoutProps): JSX.Element => {
const loginPageIllustration = useSelector(getLoginPageIllustration);
return (
- <LayoutRoot data-testid="login-page">
+ <Box data-testid="login-page" pos="relative" bg="background_page-secondary">
{loginPageIllustration &&
(loginPageIllustration.isDefault ? (
<LighthouseIllustration />
) : (
- <LayoutIllustration
+ <Box
data-testid="login-page-illustration"
- backgroundImageSrc={loginPageIllustration.src}
+ pos="absolute"
+ inset={0}
+ bgsz="100% auto"
+ bgr="no-repeat"
+ bgp="right bottom"
+ style={{ backgroundImage: `url("${loginPageIllustration.src}")` }}
/>
))}
- <LayoutBody>
+ <Stack
+ gap="xl"
+ justify="center"
+ align="center"
+ pos="relative"
+ pt="xl"
+ px="lg"
+ pb="3rem"
+ mih="100vh"
+ >
<LogoIcon height={65} />
- <LayoutCard>{children}</LayoutCard>
- </LayoutBody>
- </LayoutRoot>
+ <Card
+ w={{ base: "100%", sm: "30.875rem" }}
+ py="xxxl"
+ px={{ base: "xl", sm: "3.5rem" }}
+ radius="xs"
+ shadow="sm"
+ >
+ {children}
+ </Card>
+ </Stack>
+ </Box>
);
};
diff --git a/frontend/src/metabase/auth/components/PasswordPanel/PasswordPanel.styled.tsx b/frontend/src/metabase/auth/components/PasswordPanel/PasswordPanel.styled.tsx
deleted file mode 100644
index 5088835191d..00000000000
--- a/frontend/src/metabase/auth/components/PasswordPanel/PasswordPanel.styled.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-// eslint-disable-next-line eslint-js/no-restricted-imports
-import styled from "@emotion/styled";
-
-export const ActionList = styled.div`
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-top: 1.5rem;
-`;
-
-export const ActionListItem = styled.div`
- &:not(:last-child) {
- margin-bottom: 1rem;
- }
-`;
diff --git a/frontend/src/metabase/auth/components/PasswordPanel/PasswordPanel.tsx b/frontend/src/metabase/auth/components/PasswordPanel/PasswordPanel.tsx
index 788ad7a1ae2..a0adf88a831 100644
--- a/frontend/src/metabase/auth/components/PasswordPanel/PasswordPanel.tsx
+++ b/frontend/src/metabase/auth/components/PasswordPanel/PasswordPanel.tsx
@@ -9,14 +9,13 @@ import { PLUGIN_MULTI_FACTOR_AUTH } from "metabase/plugins";
import { useDispatch, useSelector } from "metabase/redux";
import { login } from "metabase/redux/auth";
import { useSetting } from "metabase/settings";
+import { Stack } from "metabase/ui";
import type { LoginData } from "metabase-types/api";
import { getExternalAuthProviders } from "../../selectors";
import { AuthTextLink } from "../AuthButton";
import { LoginForm } from "../LoginForm";
-import { ActionList, ActionListItem } from "./PasswordPanel.styled";
-
interface PasswordPanelProps {
redirectUrl?: string;
}
@@ -80,18 +79,14 @@ export const PasswordPanel = ({ redirectUrl }: PasswordPanelProps) => {
hasSessionCookies={hasSessionCookies}
onSubmit={handleSubmit}
/>
- <ActionList>
- <ActionListItem>
- <AuthTextLink to="/auth/forgot_password">
- {t`I seem to have forgotten my password`}
- </AuthTextLink>
- </ActionListItem>
+ <Stack align="center" mt="xl">
+ <AuthTextLink to="/auth/forgot_password">
+ {t`I seem to have forgotten my password`}
+ </AuthTextLink>
{providers.map((provider) => (
- <ActionListItem key={provider.name}>
- <provider.Button redirectUrl={redirectUrl} />
- </ActionListItem>
+ <provider.Button key={provider.name} redirectUrl={redirectUrl} />
))}
- </ActionList>
+ </Stack>
</div>
);
};