Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Avoid recreating the style everytime

Manav Rathie569a25f8768
diff --git a/web/packages/accounts/components/PasswordStrength.tsx b/web/packages/accounts/components/PasswordStrength.tsx
index d543f5cd6e..da92030a6f 100644
--- a/web/packages/accounts/components/PasswordStrength.tsx
+++ b/web/packages/accounts/components/PasswordStrength.tsx
@@ -1,4 +1,4 @@
-import { Typography } from "@mui/material";
+import { Typography, useTheme } from "@mui/material";
import { t } from "i18next";
import React, { useMemo } from "react";
import { estimatePasswordStrength } from "../utils/password";
@@ -15,20 +15,24 @@ export const PasswordStrengthHint: React.FC<PasswordStrengthHintProps> = ({
[password],
);
+ const theme = useTheme();
+ const color =
+ passwordStrength == "weak"
+ ? theme.colors.danger.A700
+ : passwordStrength == "moderate"
+ ? theme.colors.warning.A500
+ : theme.colors.accent.A500;
+
return (
<Typography
variant="small"
- sx={(theme) => ({
+ sx={{
mt: "8px",
alignSelf: "flex-start",
whiteSpace: "pre",
- color:
- passwordStrength == "weak"
- ? theme.colors.danger.A700
- : passwordStrength == "moderate"
- ? theme.colors.warning.A500
- : theme.colors.accent.A500,
- })}
+ color: "var(--color)",
+ }}
+ style={{ "--color": color } as React.CSSProperties}
>
{password
? t("passphrase_strength", { context: passwordStrength })