From bd0b3aadf8fe45552d4780eaab3e9a88a64d7068 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 15 Jan 2025 18:00:31 +0530 Subject: [PATCH] Rework --- .../accounts/components/CodeBlock.tsx | 59 +++++++------------ .../accounts/components/RecoveryKey.tsx | 17 +++--- .../components/two-factor/TwoFactorSetup.tsx | 2 +- web/packages/base/components/containers.tsx | 10 ++++ 4 files changed, 42 insertions(+), 46 deletions(-) diff --git a/web/packages/accounts/components/CodeBlock.tsx b/web/packages/accounts/components/CodeBlock.tsx index c22a074c5b..8910cc0179 100644 --- a/web/packages/accounts/components/CodeBlock.tsx +++ b/web/packages/accounts/components/CodeBlock.tsx @@ -1,7 +1,7 @@ +import { CenteredFlex } from "@/base/components/containers"; import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator"; -import { CenteredFlex } from "@ente/shared/components/Container"; import CopyButton from "@ente/shared/components/CopyButton"; -import { styled } from "@mui/material"; +import { Box } from "@mui/material"; import React from "react"; interface CodeBlockProps { @@ -20,46 +20,31 @@ interface CodeBlockProps { export const CodeBlock: React.FC = ({ code }) => { if (!code) { return ( - + - + ); } return ( - - {code} - + + + {code} + + - - + + ); }; - -const Wrapper = styled(CenteredFlex)( - ({ theme }) => ` - position: relative; - background-color: ${theme.vars.palette.accent.dark}; - border-radius: ${theme.shape.borderRadius}px; - min-height: 80px; -`, -); - -const CodeWrapper = styled("div")( - ({ theme }) => ` - padding: 16px 36px 16px 16px; - border-radius: ${theme.shape.borderRadius}px; - word-break: break-word; - min-width: 30%; - text-align: left; -`, -); - -const CopyButtonWrapper = styled("div")( - ({ theme }) => ` - position: absolute; - top: 0px; - right: 0px; - margin-top: ${theme.spacing(1)}; -`, -); diff --git a/web/packages/accounts/components/RecoveryKey.tsx b/web/packages/accounts/components/RecoveryKey.tsx index 67305cb19f..05932fe166 100644 --- a/web/packages/accounts/components/RecoveryKey.tsx +++ b/web/packages/accounts/components/RecoveryKey.tsx @@ -13,8 +13,8 @@ import { DialogActions, DialogContent, DialogTitle, + Stack, Typography, - styled, } from "@mui/material"; import * as bip39 from "bip39"; import { t } from "i18next"; @@ -82,12 +82,18 @@ export const RecoveryKey: React.FC = ({ {t("recovery_key_description")} - + {t("key_not_stored_note")} - + = ({ ); }; -const DashedBorderWrapper = styled("div")(({ theme }) => ({ - border: `1px dashed ${theme.palette.grey.A400}`, - borderRadius: theme.spacing(1), -})); - const getRecoveryKeyMnemonic = async () => bip39.entropyToMnemonic(await getRecoveryKey()); diff --git a/web/packages/accounts/components/two-factor/TwoFactorSetup.tsx b/web/packages/accounts/components/two-factor/TwoFactorSetup.tsx index 1a64d70e9e..bdf12b4600 100644 --- a/web/packages/accounts/components/two-factor/TwoFactorSetup.tsx +++ b/web/packages/accounts/components/two-factor/TwoFactorSetup.tsx @@ -49,7 +49,7 @@ function SetupManualMode({ {t("two_factor_manual_entry_message")} - + {t("scan_qr_title")} diff --git a/web/packages/base/components/containers.tsx b/web/packages/base/components/containers.tsx index e95893f2dc..2c4a17694f 100644 --- a/web/packages/base/components/containers.tsx +++ b/web/packages/base/components/containers.tsx @@ -24,6 +24,16 @@ export const SpaceBetweenFlex = styled("div")` align-items: center; `; +/** + * A flex child that shows its children after centering them both vertically and + * horizontally. + */ +export const CenteredFlex = styled("div")` + display: flex; + justify-content: center; + align-items: center; +`; + /** * A flex child that fills the entire flex direction, and shows its children * after centering them both vertically and horizontally.