The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Migrating Forgot and Reset password pages from Emotion to CSS Modules (#83754)
Nick Fitzpatrick9286f696dc50
diff --git a/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.module.css b/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.module.cssnew file mode 100644index 00000000000..afe330ab2b6--- /dev/null+++ b/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.module.css@@ -0,0 +1,15 @@+.infoIconContainer {+ padding: 1.25rem;+ border-radius: 50%;+ background-color: var(--mb-color-background_surface-brand-subtle);+ margin-bottom: var(--mantine-spacing-xl);+}++.infoLink {+ color: var(--mb-color-text-primary);+ margin-top: 2.5rem;++ &:hover {+ color: var(--mb-color-core-brand);+ }+}diff --git a/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.styled.tsx b/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.styled.tsxdeleted file mode 100644index a165ca490be..00000000000--- a/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.styled.tsx+++ /dev/null@@ -1,40 +0,0 @@-// eslint-disable-next-line eslint-js/no-restricted-imports-import styled from "@emotion/styled";--import { Link } from "metabase/common/components/Link";-import { Icon } from "metabase/ui";--export const InfoBody = styled.div`- display: flex;- flex-direction: column;- align-items: center;-`;--export const InfoIcon = styled(Icon)`- display: block;- color: var(--mb-color-core-brand);- width: 1.5rem;- height: 1.5rem;-`;--export const InfoIconContainer = styled.div`- padding: 1.25rem;- border-radius: 50%;- background-color: var(--mb-color-background_surface-brand-subtle);- margin-bottom: 1.5rem;-`;--export const InfoMessage = styled.div`- color: var(--mb-color-text-primary);- text-align: center;- margin-bottom: 1rem;-`;--export const InfoLink = styled(Link)`- color: var(--mb-color-text-primary);- margin-top: 2.5rem;-- &:hover {- color: var(--mb-color-core-brand);- }-`;diff --git a/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.tsx b/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.tsxindex bca32241dae..206681926f3 100644--- a/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.tsx+++ b/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.tsx@@ -1,22 +1,17 @@import { useCallback, useState } from "react";import { t } from "ttag";+import { Link } from "metabase/common/components/Link";import { useDispatch } from "metabase/redux";import { forgotPassword } from "metabase/redux/auth";import type { Location } from "metabase/router";import { useSetting } from "metabase/settings";-import { Button } from "metabase/ui";+import { Box, Button, Flex, Icon } from "metabase/ui";import { AuthLayout } from "../AuthLayout";import { ForgotPasswordForm } from "../ForgotPasswordForm";-import {- InfoBody,- InfoIcon,- InfoIconContainer,- InfoLink,- InfoMessage,-} from "./ForgotPassword.styled";+import S from "./ForgotPassword.module.css";type ViewType = "form" | "disabled" | "success";@@ -62,29 +57,29 @@ export const ForgotPassword = ({const ForgotPasswordSuccess = (): JSX.Element => {return (- <InfoBody>- <InfoIconContainer>- <InfoIcon name="check" />- </InfoIconContainer>- <InfoMessage>+ <Flex direction="column" align="center">+ <Box className={S.infoIconContainer}>+ <Icon name="check" display="block" c="core-brand" size={24} />+ </Box>+ <Box c="text-primary" ta="center" mb="lg">{t` If the email exists, we'll send instructions on how to reset your password.`}- </InfoMessage>+ </Box><Buttonvariant="filled"component="a"href="/auth/login">{t`Back to sign in`}</Button>- </InfoBody>+ </Flex>);};const ForgotPasswordDisabled = (): JSX.Element => {return (- <InfoBody>- <InfoMessage>+ <Flex direction="column" align="center">+ <Box c="text-primary" ta="center" mb="lg">{t`Please contact an administrator to have them reset your password.`}- </InfoMessage>- <InfoLink to="/auth/login">{t`Back to sign in`}</InfoLink>- </InfoBody>+ </Box>+ <Link className={S.infoLink} to="/auth/login">{t`Back to sign in`}</Link>+ </Flex>);};diff --git a/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.module.css b/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.module.cssnew file mode 100644index 00000000000..87cd073fbbf--- /dev/null+++ b/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.module.css@@ -0,0 +1,7 @@+.passwordFormLink {+ color: var(--mb-color-text-primary);++ &:hover {+ color: var(--mb-color-core-brand);+ }+}diff --git a/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.styled.tsx b/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.styled.tsxdeleted file mode 100644index 81a7d64904f..00000000000--- a/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.styled.tsx+++ /dev/null@@ -1,28 +0,0 @@-// eslint-disable-next-line eslint-js/no-restricted-imports-import styled from "@emotion/styled";--import { Link } from "metabase/common/components/Link/Link";--export const PasswordFormTitle = styled.div`- color: var(--mb-color-text-primary);- font-size: 1.25rem;- font-weight: 700;- line-height: 1.5rem;- text-align: center;- margin-bottom: 1.5rem;-`;--export const PasswordFormFooter = styled.div`- display: flex;- flex-direction: column;- align-items: center;- margin-top: 1.5rem;-`;--export const PasswordFormLink = styled(Link)`- color: var(--mb-color-text-primary);-- &:hover {- color: var(--mb-color-core-brand);- }-`;diff --git a/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.tsx b/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.tsxindex 0b21f0ec509..60351bd6b2a 100644--- a/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.tsx+++ b/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.tsx@@ -2,6 +2,7 @@ import { useCallback, useMemo } from "react";import { t } from "ttag";import * as Yup from "yup";+import { Link } from "metabase/common/components/Link";import {Form,FormErrorMessage,@@ -11,16 +12,12 @@ import {} from "metabase/forms";import { useSelector } from "metabase/redux";import { getApplicationName } from "metabase/selectors/whitelabel";-import { Stack } from "metabase/ui";+import { Flex, Stack, Title } from "metabase/ui";import * as Errors from "metabase/utils/errors";import type { ForgotPasswordData } from "../../types";-import {- PasswordFormFooter,- PasswordFormLink,- PasswordFormTitle,-} from "./ForgotPasswordForm.styled";+import S from "./ForgotPasswordForm.module.css";const FORGOT_PASSWORD_SCHEMA = Yup.object({email: Yup.string().required(Errors.required).email(Errors.email),@@ -49,7 +46,13 @@ export const ForgotPasswordForm = ({return (<div>- <PasswordFormTitle>{t`Forgot password`}</PasswordFormTitle>+ <Title+ order={1}+ size="h3"+ c="text-primary"+ ta="center"+ mb="xl"+ >{t`Forgot password`}</Title><FormProviderinitialValues={initialValues}validationSchema={FORGOT_PASSWORD_SCHEMA}@@ -70,9 +73,12 @@ export const ForgotPasswordForm = ({<FormErrorMessage /></Form></FormProvider>- <PasswordFormFooter>- <PasswordFormLink to="/auth/login">{t`Back to sign in`}</PasswordFormLink>- </PasswordFormFooter>+ <Flex direction="column" align="center" mt="xl">+ <Link+ className={S.passwordFormLink}+ to="/auth/login"+ >{t`Back to sign in`}</Link>+ </Flex></div>);};diff --git a/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.styled.tsx b/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.styled.tsxdeleted file mode 100644index 8e4e285dac7..00000000000--- a/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.styled.tsx+++ /dev/null@@ -1,23 +0,0 @@-// eslint-disable-next-line eslint-js/no-restricted-imports-import styled from "@emotion/styled";--export const InfoBody = styled.div`- display: flex;- flex-direction: column;- align-items: center;-`;--export const InfoTitle = styled.div`- color: var(--mb-color-text-primary);- font-size: 1.25rem;- font-weight: 700;- line-height: 1.5rem;- text-align: center;- margin-bottom: 1rem;-`;--export const InfoMessage = styled.div`- color: var(--mb-color-text-primary);- text-align: center;- margin-bottom: 2.5rem;-`;diff --git a/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.tsx b/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.tsxindex 3a90fafafad..e7ccc1550d8 100644--- a/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.tsx+++ b/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.tsx@@ -8,15 +8,13 @@ import { useToast } from "metabase/common/hooks/use-toast";import { useDispatch } from "metabase/redux";import { resetPassword } from "metabase/redux/auth";import { useNavigate, useParams, useSearchParams } from "metabase/router";-import { Button } from "metabase/ui";+import { Box, Button, Flex, Title } from "metabase/ui";import * as Urls from "metabase/urls";import type { ResetPasswordData } from "../../types";import { AuthLayout } from "../AuthLayout";import { ResetPasswordForm } from "../ResetPasswordForm";-import { InfoBody, InfoMessage, InfoTitle } from "./ResetPassword.styled";-type ResetPasswordQueryParams = {token: string;email: string;@@ -77,14 +75,20 @@ const ResetPasswordExpired = ({: "/auth/forgot_password";return (- <InfoBody>- <InfoTitle>{t`Whoops, that's an expired link`}</InfoTitle>- <InfoMessage>+ <Flex direction="column" align="center">+ <Title+ order={1}+ size="h3"+ c="text-primary"+ ta="center"+ mb="lg"+ >{t`Whoops, that's an expired link`}</Title>+ <Box c="text-primary" ta="center" mb="xxxl">{t`For security reasons, password reset links expire after a little while. If you still need to reset your password, you can request a new reset email.`}- </InfoMessage>+ </Box><Button component={Link} variant="filled" to={forgotPasswordUrl}>{t`Request a new reset email`}</Button>- </InfoBody>+ </Flex>);};diff --git a/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.styled.tsx b/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.styled.tsxdeleted file mode 100644index 13d7fb1c4ac..00000000000--- a/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.styled.tsx+++ /dev/null@@ -1,17 +0,0 @@-// eslint-disable-next-line eslint-js/no-restricted-imports-import styled from "@emotion/styled";--export const PasswordFormTitle = styled.div`- color: var(--mb-color-text-primary);- font-size: 1.25rem;- font-weight: 700;- line-height: 1.5rem;- text-align: center;- margin-bottom: 1rem;-`;--export const PasswordFormMessage = styled.div`- color: var(--mb-color-text-primary);- text-align: center;- margin-bottom: 1.5rem;-`;diff --git a/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.tsx b/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.tsxindex 2205999f7e5..48ab233c674 100644--- a/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.tsx+++ b/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.tsx@@ -9,18 +9,13 @@ import {FormSubmitButton,FormTextInput,} from "metabase/forms";-import { Stack } from "metabase/ui";+import { Box, Stack, Title } from "metabase/ui";import * as Errors from "metabase/utils/errors";import { memoize } from "metabase/utils/memoize";import { passwordComplexityDescription } from "metabase/utils/password";import type { ResetPasswordData } from "../../types";-import {- PasswordFormMessage,- PasswordFormTitle,-} from "./ResetPasswordForm.styled";-const getResetPasswordSchema = () =>Yup.object({password: Yup.string()@@ -60,10 +55,16 @@ export const ResetPasswordForm = ({return (<div>- <PasswordFormTitle>{t`New password`}</PasswordFormTitle>- <PasswordFormMessage>+ <Title+ order={1}+ size="h3"+ c="text-primary"+ ta="center"+ mb="lg"+ >{t`New password`}</Title>+ <Box c="text-primary" ta="center" mb="xl">{t`To keep your data secure, passwords ${passwordDescription}`}- </PasswordFormMessage>+ </Box><FormProviderinitialValues={initialValues}validationSchema={getResetPasswordSchema()}