Skip to content

Commit 25359be

Browse files
committed
Facelift: use product300 for selected nav item; revert all row hover changes
1 parent c863b52 commit 25359be

9 files changed

Lines changed: 16 additions & 35 deletions

File tree

src/components/LHNOptionsList/OptionRowLHN/useOptionRowChrome.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function useOptionRowChrome({isOptionFocused, viewMode}: UseOptionRowChromeParam
4444
);
4545
const contentContainerStyles = isInFocusMode ? [styles.flex1, styles.flexRow, styles.overflowHidden, StyleUtils.getCompactContentContainerStyles()] : [styles.flex1];
4646

47-
const hoveredBackgroundColor = theme.sidebarHover;
47+
const hoveredBackgroundColor = !!styles.sidebarLinkHover && 'backgroundColor' in styles.sidebarLinkHover ? styles.sidebarLinkHover.backgroundColor : theme.sidebar;
4848
const focusedBackgroundColor = theme.navItemSelectedBG;
4949

5050
let avatarBackgroundColor: ColorValue = theme.sidebar;

src/components/MenuItem/MenuItem.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -884,23 +884,12 @@ function MenuItem({
884884
isCompact && styles.optionRowCompact,
885885
isCompactPopoverItem && (description ? styles.compactPopoverMenuItemBase : styles.compactPopoverMenuItem),
886886
!shouldRemoveBackground &&
887-
// Nav rows (role=tab) skip the pressed background so a press keeps the hover/selected color and only dims via opacity
888-
StyleUtils.getButtonBackgroundColorStyle(
889-
getButtonState(focused || isHovered, role === CONST.ROLE.TAB ? false : pressed, success, disabled, interactive),
890-
true,
891-
),
887+
StyleUtils.getButtonBackgroundColorStyle(getButtonState(focused || isHovered, pressed, success, disabled, interactive), true),
892888
...(Array.isArray(wrapperStyle) ? wrapperStyle : [wrapperStyle]),
893889
shouldGreyOutWhenDisabled && disabled && styles.buttonOpacityDisabled,
894-
// Nav rows (role=tab) hold the hover color through a press (dimmed via opacity); other rows drop it on press
895-
isHovered &&
896-
interactive &&
897-
!focused &&
898-
!shouldRemoveBackground &&
899-
!shouldRemoveHoverBackground &&
900-
(role === CONST.ROLE.TAB || !pressed) &&
901-
styles.hoveredComponentBG,
902-
// Nav rows (role=tab) use the product300 selected color, held through a press
903-
role === CONST.ROLE.TAB && focused && !shouldRemoveBackground && StyleUtils.getBackgroundColorStyle(theme.navItemSelectedBG),
890+
isHovered && interactive && !focused && !pressed && !shouldRemoveBackground && !shouldRemoveHoverBackground && styles.hoveredComponentBG,
891+
// Nav rows (role=tab) use product300 for the selected state
892+
role === CONST.ROLE.TAB && focused && !pressed && !shouldRemoveBackground && StyleUtils.getBackgroundColorStyle(theme.navItemSelectedBG),
904893
] as StyleProp<ViewStyle>
905894
}
906895
disabledStyle={shouldUseDefaultCursorWhenDisabled && [styles.cursorDefault]}

src/components/TabSelector/getBackground.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,22 @@ import type {Animated} from 'react-native';
44
import type {BackgroundColor, GetBackgroundColorConfig} from './types';
55

66
function getBackgroundColor({routesLength, tabIndex, affectedTabs, theme, position, isActive}: GetBackgroundColorConfig): BackgroundColor {
7-
// High contrast keeps the stronger prior active-tab color (theme.border resolves to product500 there) instead of the lighter product300
8-
const activeBackgroundColor = theme.isHighContrast ? theme.border : theme.navItemSelectedBG;
9-
107
if (routesLength > 1) {
118
const inputRange = Array.from({length: routesLength}, (_, i) => i);
129

1310
if (position) {
1411
return position.interpolate({
1512
inputRange,
1613
outputRange: inputRange.map((i) => {
17-
return affectedTabs.includes(tabIndex) && i === tabIndex ? activeBackgroundColor : theme.appBG;
14+
return affectedTabs.includes(tabIndex) && i === tabIndex ? theme.navItemSelectedBG : theme.appBG;
1815
}),
1916
}) as unknown as Animated.AnimatedInterpolation<string>;
2017
}
2118

22-
return affectedTabs.includes(tabIndex) && isActive ? activeBackgroundColor : theme.appBG;
19+
return affectedTabs.includes(tabIndex) && isActive ? theme.navItemSelectedBG : theme.appBG;
2320
}
2421

25-
return activeBackgroundColor;
22+
return theme.navItemSelectedBG;
2623
}
2724

2825
export default getBackgroundColor;

src/pages/Search/SearchTypeMenuItem.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,13 @@ function SearchTypeMenuItem({title, icon, badgeText, focused = false, onPress}:
8282
accessibilityState={{selected: focused}}
8383
role={CONST.ROLE.TAB}
8484
sentryLabel={CONST.SENTRY_LABEL.SEARCH.TYPE_MENU_ITEM}
85-
// A press keeps the hover/selected color and only dims via opacity, matching the Inbox LHN rows
8685
style={({hovered, pressed}) => [
8786
styles.flexRow,
8887
styles.sectionMenuItem(shouldUseNarrowLayout),
8988
styles.searchTypeMenuItemPadding,
90-
focused ? StyleUtils.getBackgroundColorStyle(theme.navItemSelectedBG) : undefined,
91-
hovered && !focused ? styles.hoveredComponentBG : undefined,
92-
pressed ? {opacity: variables.pressDimValue} : undefined,
89+
StyleUtils.getButtonBackgroundColorStyle(getButtonState(focused || hovered, pressed, false, false, true), true),
90+
hovered && !focused && !pressed && styles.hoveredComponentBG,
91+
focused && !pressed ? StyleUtils.getBackgroundColorStyle(theme.navItemSelectedBG) : undefined,
9392
]}
9493
>
9594
{({hovered, pressed}) => (

src/styles/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6862,7 +6862,7 @@ const dynamicStyles = (theme: ThemeColors) =>
68626862
}
68636863

68646864
return {
6865-
backgroundColor: hovered && !isFocused ? theme.hoverComponentBG : (background as string),
6865+
backgroundColor: hovered && !isFocused ? theme.highlightBG : (background as string),
68666866
};
68676867
},
68686868

src/styles/theme/themes/dark-contrast.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import darkTheme from './dark';
55

66
const darkContrastTheme = {
77
...darkTheme,
8-
// Keep nav rows/tabs at the stronger prior selected value so the state stays legible under high contrast
9-
navItemSelectedBG: colors.productDark400,
108
border: colors.productDark500,
119
icon: colors.productDark700,
1210
textSupporting: colors.productDark800,

src/styles/theme/themes/dark.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ const darkTheme = {
5252
inverse: colors.productDark900,
5353
shadow: '0px 4px 12px 0px rgba(2,18,4,0.24)',
5454
componentBG: colors.productDark100,
55-
hoverComponentBG: 'rgba(10, 46, 37, 0.6)',
55+
hoverComponentBG: colors.productDark300,
5656
messageHighlightBG: colors.messageHighlightDark,
5757
activeComponentBG: colors.productDark400,
5858
navItemSelectedBG: colors.productDark300,
5959
signInSidebar: colors.green800,
6060
sidebar: colors.productDark100,
61-
sidebarHover: 'rgba(10, 46, 37, 0.6)',
61+
sidebarHover: colors.productDark300,
6262
heading: colors.productDark900,
6363
textLight: colors.productDark900,
6464
textDark: colors.productDark100,

src/styles/theme/themes/light-contrast.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import lightTheme from './light';
55

66
const lightContrastTheme = {
77
...lightTheme,
8-
// Keep nav rows/tabs at the stronger prior selected value so the state stays legible under high contrast
9-
navItemSelectedBG: colors.productLight400,
108
border: colors.productLight500,
119
icon: colors.productLight800,
1210
textSupporting: '#53645C',

src/styles/theme/themes/light.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ const lightTheme = {
5353
shadow: '0px 4px 12px 0px rgba(2,18,4,0.06)',
5454
componentBG: colors.productLight100,
5555
messageHighlightBG: colors.yellow100,
56-
hoverComponentBG: 'rgba(242, 237, 231, 0.6)',
56+
hoverComponentBG: colors.productLight300,
5757
activeComponentBG: colors.productLight400,
5858
navItemSelectedBG: colors.productLight300,
5959
signInSidebar: colors.green800,
6060
sidebar: colors.productLight100,
61-
sidebarHover: 'rgba(242, 237, 231, 0.6)',
61+
sidebarHover: colors.productLight300,
6262
heading: colors.productLight900,
6363
textLight: colors.white,
6464
textDark: colors.productLight900,

0 commit comments

Comments
 (0)