Skip to content

Commit cebedbf

Browse files
committed
Facelift: set activeComponentBG to product300 and route menu-item/tab selected through it
1 parent 25359be commit cebedbf

10 files changed

Lines changed: 8 additions & 18 deletions

File tree

src/components/LHNOptionsList/OptionRowLHN/OptionRow/Pressable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function Pressable({optionItem, isOptionFocused, onSelectRow, onLayout, onHoverI
167167
styles.sidebarLink,
168168
styles.sidebarLinkInnerLHN,
169169
StyleUtils.getBackgroundColorStyle(theme.sidebar),
170-
isOptionFocused ? StyleUtils.getBackgroundColorStyle(theme.navItemSelectedBG) : null,
170+
isOptionFocused ? styles.sidebarLinkActive : null,
171171
(hovered || isContextMenuActive) && !isOptionFocused ? styles.sidebarLinkHover : null,
172172
]}
173173
role={CONST.ROLE.BUTTON}

src/components/LHNOptionsList/OptionRowLHN/useOptionRowChrome.ts

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

4747
const hoveredBackgroundColor = !!styles.sidebarLinkHover && 'backgroundColor' in styles.sidebarLinkHover ? styles.sidebarLinkHover.backgroundColor : theme.sidebar;
48-
const focusedBackgroundColor = theme.navItemSelectedBG;
48+
const focusedBackgroundColor = styles.sidebarLinkActive.backgroundColor;
4949

5050
let avatarBackgroundColor: ColorValue = theme.sidebar;
5151
if (isOptionFocused) {

src/components/MenuItem/MenuItem.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,8 +888,6 @@ function MenuItem({
888888
...(Array.isArray(wrapperStyle) ? wrapperStyle : [wrapperStyle]),
889889
shouldGreyOutWhenDisabled && disabled && styles.buttonOpacityDisabled,
890890
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),
893891
] as StyleProp<ViewStyle>
894892
}
895893
disabledStyle={shouldUseDefaultCursorWhenDisabled && [styles.cursorDefault]}

src/components/TabSelector/getBackground.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ function getBackgroundColor({routesLength, tabIndex, affectedTabs, theme, positi
1111
return position.interpolate({
1212
inputRange,
1313
outputRange: inputRange.map((i) => {
14-
return affectedTabs.includes(tabIndex) && i === tabIndex ? theme.navItemSelectedBG : theme.appBG;
14+
return affectedTabs.includes(tabIndex) && i === tabIndex ? theme.activeComponentBG : theme.appBG;
1515
}),
1616
}) as unknown as Animated.AnimatedInterpolation<string>;
1717
}
1818

19-
return affectedTabs.includes(tabIndex) && isActive ? theme.navItemSelectedBG : theme.appBG;
19+
return affectedTabs.includes(tabIndex) && isActive ? theme.activeComponentBG : theme.appBG;
2020
}
2121

22-
return theme.navItemSelectedBG;
22+
return theme.activeComponentBG;
2323
}
2424

2525
export default getBackgroundColor;

src/pages/Search/SearchTypeMenuItem.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import TooltipSense from '@components/Tooltip/TooltipSense';
88

99
import useResponsiveLayout from '@hooks/useResponsiveLayout';
1010
import useStyleUtils from '@hooks/useStyleUtils';
11-
import useTheme from '@hooks/useTheme';
1211
import useThemeStyles from '@hooks/useThemeStyles';
1312

1413
import getButtonState from '@libs/getButtonState';
@@ -50,7 +49,6 @@ const COLLAPSED_BADGE_EXIT_DURATION_MS = 90;
5049
function SearchTypeMenuItem({title, icon, badgeText, focused = false, onPress}: SearchTypeMenuItemProps) {
5150
const styles = useThemeStyles();
5251
const StyleUtils = useStyleUtils();
53-
const theme = useTheme();
5452
const {shouldUseNarrowLayout} = useResponsiveLayout();
5553
const {isVisuallyCollapsed} = useSearchSidebarCollapse();
5654
const labelAnimatedStyle = useSearchSidebarCollapseFadeStyle();
@@ -88,7 +86,6 @@ function SearchTypeMenuItem({title, icon, badgeText, focused = false, onPress}:
8886
styles.searchTypeMenuItemPadding,
8987
StyleUtils.getButtonBackgroundColorStyle(getButtonState(focused || hovered, pressed, false, false, true), true),
9088
hovered && !focused && !pressed && styles.hoveredComponentBG,
91-
focused && !pressed ? StyleUtils.getBackgroundColorStyle(theme.navItemSelectedBG) : undefined,
9289
]}
9390
>
9491
{({hovered, pressed}) => (

src/pages/domain/DomainInitialPage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ function DomainInitialPage({route}: DomainInitialPageProps) {
164164
highlighted={!!item?.highlighted}
165165
focused={!!(item.screenName && activeRoute?.startsWith(item.screenName))}
166166
badgeText={item.badgeText}
167-
role={CONST.ROLE.TAB}
168167
shouldIconUseAutoWidthStyle
169168
/>
170169
))}

src/styles/theme/themes/dark.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ const darkTheme = {
5454
componentBG: colors.productDark100,
5555
hoverComponentBG: colors.productDark300,
5656
messageHighlightBG: colors.messageHighlightDark,
57-
activeComponentBG: colors.productDark400,
58-
navItemSelectedBG: colors.productDark300,
57+
activeComponentBG: colors.productDark300,
5958
signInSidebar: colors.green800,
6059
sidebar: colors.productDark100,
6160
sidebarHover: colors.productDark300,

src/styles/theme/themes/light.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ const lightTheme = {
5454
componentBG: colors.productLight100,
5555
messageHighlightBG: colors.yellow100,
5656
hoverComponentBG: colors.productLight300,
57-
activeComponentBG: colors.productLight400,
58-
navItemSelectedBG: colors.productLight300,
57+
activeComponentBG: colors.productLight300,
5958
signInSidebar: colors.green800,
6059
sidebar: colors.productLight100,
6160
sidebarHover: colors.productLight300,

src/styles/theme/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ type ThemeColors = {
6363
componentBG: Color;
6464
hoverComponentBG: Color;
6565
activeComponentBG: Color;
66-
/** Background color for a selected/active left-hand-nav row or horizontal tab */
67-
navItemSelectedBG: Color;
6866
signInSidebar: Color;
6967
sidebar: Color;
7068
sidebarHover: Color;

src/styles/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({
16581658
case CONST.BUTTON_STATES.PRESSED:
16591659
return isMenuItem ? {backgroundColor: theme.buttonHoveredBG} : {backgroundColor: theme.buttonPressedBG};
16601660
case CONST.BUTTON_STATES.ACTIVE:
1661-
return isMenuItem ? {backgroundColor: theme.border} : {backgroundColor: theme.buttonHoveredBG};
1661+
return isMenuItem ? {backgroundColor: theme.activeComponentBG} : {backgroundColor: theme.buttonHoveredBG};
16621662
case CONST.BUTTON_STATES.DISABLED:
16631663
case CONST.BUTTON_STATES.DEFAULT:
16641664
default:

0 commit comments

Comments
 (0)