Skip to content

Commit 384c947

Browse files
committed
fix: broken color on welcome page
1 parent 86dd00d commit 384c947

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

src/app/pages/onboarding/set-password/components/password-field.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { OnboardingSelectors } from '@tests/selectors/onboarding.selectors';
44
import { useField } from 'formik';
55
import { Box, Flex, styled } from 'leather-styles/jsx';
66

7+
import { useThemeSwitcher } from '@app/common/theme-provider';
78
import { ValidatedPassword } from '@app/common/validation/validate-password';
89
import { Input } from '@app/ui/components/input/input';
910
import { Caption } from '@app/ui/components/typography/caption';
@@ -20,8 +21,9 @@ interface PasswordFieldProps {
2021
export function PasswordField({ strengthResult, isDisabled }: PasswordFieldProps) {
2122
const [field] = useField('password');
2223
const [showPassword, setShowPassword] = useState(false);
24+
const { theme } = useThemeSwitcher();
2325

24-
const { strengthColor, strengthText } = useMemo(
26+
const { strengthColorLightMode, strengthColorDarkMode, strengthText } = useMemo(
2527
() => getIndicatorsOfPasswordStrength(strengthResult),
2628
[strengthResult]
2729
);
@@ -62,7 +64,7 @@ export function PasswordField({ strengthResult, isDisabled }: PasswordFieldProps
6264
</Box>
6365
<PasswordStrengthIndicator
6466
password={field.value}
65-
strengthColor={strengthColor}
67+
strengthColor={theme === 'light' ? strengthColorLightMode : strengthColorDarkMode}
6668
strengthResult={strengthResult}
6769
/>
6870
<Flex alignItems="center">

src/app/pages/onboarding/set-password/components/password-field.utils.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,33 @@ export const defaultColor = token('colors.ink.background-secondary');
66

77
const strengthStyles = {
88
[PasswordStrength.NoScore]: {
9-
strengthColor: token('colors.red.action-primary-default'),
9+
strengthColorLightMode: token('colors.red.background-secondary'),
10+
strengthColorDarkMode: token('colors.red.border'),
1011
strengthText: 'Poor',
1112
},
1213
[PasswordStrength.PoorScore]: {
13-
strengthColor: token('colors.red.action-primary-default'),
14+
strengthColorLightMode: token('colors.red.background-secondary'),
15+
strengthColorDarkMode: token('colors.red.border'),
1416
strengthText: 'Poor',
1517
},
1618
[PasswordStrength.WeakScore]: {
17-
strengthColor: token('colors.yellow.action-primary-default'),
19+
strengthColorLightMode: token('colors.yellow.background-secondary'),
20+
strengthColorDarkMode: token('colors.yellow.border'),
1821
strengthText: 'Weak',
1922
},
2023
[PasswordStrength.AverageScore]: {
21-
strengthColor: token('colors.yellow.action-primary-default'),
24+
strengthColorLightMode: token('colors.yellow.background-secondary'),
25+
strengthColorDarkMode: token('colors.yellow.border'),
2226
strengthText: 'Average',
2327
},
2428
[PasswordStrength.StrongScore]: {
25-
strengthColor: token('colors.yellow.action-primary-default'),
29+
strengthColorLightMode: token('colors.yellow.background-secondary'),
30+
strengthColorDarkMode: token('colors.yellow.border'),
2631
strengthText: 'Average',
2732
},
2833
[PasswordStrength.MeetsAllRequirements]: {
29-
strengthColor: token('colors.green.action-primary-default'),
34+
strengthColorLightMode: token('colors.green.background-secondary'),
35+
strengthColorDarkMode: token('colors.green.border'),
3036
strengthText: 'Strong',
3137
},
3238
};

src/app/pages/onboarding/welcome/welcome.layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function WelcomeLayout({
3737
flexDir="column"
3838
flex={[1, 1, 0]}
3939
justifyContent={['center', '', 'flex-start']}
40-
color={['ink.background-primary', '', 'ink.background-secondary']}
40+
color={['ink.text-primary', '', 'ink.background-secondary']}
4141
>
4242
<Box>
4343
<styled.h1 textStyle={['heading.03', '', 'display.02', 'display.01']}>

0 commit comments

Comments
 (0)