Skip to content

Commit 1bd5630

Browse files
authored
Merge pull request Expensify#89600 from Expensify/claude-fixGreenButtonTextContrast
Use preserved high contrast mode preference on sign-in page
2 parents 90f60ca + e135ab7 commit 1bd5630

3 files changed

Lines changed: 21 additions & 12 deletions

File tree

src/pages/signin/SignInPage.tsx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,25 @@ function SignInPageWrapper({ref}: SignInPageProps) {
356356
}
357357

358358
// WithTheme is a HOC that provides theme-related contexts (e.g. to the SignInPageWrapper component since these contexts are required for variable declarations).
359+
// The sign-in page always uses the dark theme, but respects the user's contrast preference (nvp_preferredTheme) which is preserved on sign-out.
359360
function WithTheme(Component: React.ComponentType<SignInPageProps>) {
360-
return ({ref}: SignInPageProps) => (
361-
<ThemeProvider theme={CONST.THEME.DARK}>
362-
<ThemeStylesProvider>
363-
<HTMLEngineProvider>
364-
<Component ref={ref} />
365-
</HTMLEngineProvider>
366-
</ThemeStylesProvider>
367-
</ThemeProvider>
368-
);
361+
function ThemedComponent({ref}: SignInPageProps) {
362+
const [preferredTheme] = useOnyx(ONYXKEYS.PREFERRED_THEME);
363+
const contrastThemes: string[] = [CONST.THEME.DARK_CONTRAST, CONST.THEME.LIGHT_CONTRAST, CONST.THEME.SYSTEM_CONTRAST];
364+
const signInTheme = contrastThemes.includes(preferredTheme ?? '') ? CONST.THEME.DARK_CONTRAST : CONST.THEME.DARK;
365+
366+
return (
367+
<ThemeProvider theme={signInTheme}>
368+
<ThemeStylesProvider>
369+
<HTMLEngineProvider>
370+
<Component ref={ref} />
371+
</HTMLEngineProvider>
372+
</ThemeStylesProvider>
373+
</ThemeProvider>
374+
);
375+
}
376+
ThemedComponent.displayName = `WithTheme(${Component.displayName ?? Component.name ?? 'Component'})`;
377+
return ThemedComponent;
369378
}
370379

371380
const SignInPageThemed = WithTheme(SignInPage);

src/pages/signin/Socials.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function Socials() {
7474
src={icons[social.iconURL]}
7575
height={variables.iconSizeLarge}
7676
width={variables.iconSizeLarge}
77-
fill={hovered || pressed ? theme.link : theme.textLight}
77+
fill={hovered || pressed ? theme.link : theme.text}
7878
/>
7979
)}
8080
</PressableWithoutFeedback>

src/styles/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4039,7 +4039,7 @@ const staticStyles = (theme: ThemeColors) =>
40394039
footerRow: {
40404040
paddingVertical: 4,
40414041
marginBottom: 8,
4042-
color: theme.textLight,
4042+
color: theme.text,
40434043
fontSize: variables.fontSizeMedium,
40444044
},
40454045

@@ -4165,7 +4165,7 @@ const staticStyles = (theme: ThemeColors) =>
41654165
loginHeroBody: {
41664166
...FontUtils.fontFamily.platform.EXP_NEUE,
41674167
fontSize: variables.fontSizeSignInHeroBody,
4168-
color: theme.textLight,
4168+
color: theme.text,
41694169
textAlign: 'center',
41704170
},
41714171

0 commit comments

Comments
 (0)