Skip to content

Commit 6714c62

Browse files
committed
Facelift: align compound MenuItem hover default, extend hover step map, simplify Spend selected bg
1 parent 32a0d35 commit 6714c62

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/components/MenuItem/layout/MenuItemRoot.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
77
import {useSurfaceBackgroundColor} from '@components/SurfaceBackgroundColorContext';
88

99
import useStyleUtils from '@hooks/useStyleUtils';
10+
import useTheme from '@hooks/useTheme';
1011
import useThemeStyles from '@hooks/useThemeStyles';
1112

1213
import getButtonState from '@libs/getButtonState';
@@ -41,6 +42,7 @@ type MenuItemRootProps = PropsWithChildren &
4142
function MenuItemRoot({children, onPress, isDisabled = false, sentryLabel, accessibilityLabel}: MenuItemRootProps) {
4243
const styles = useThemeStyles();
4344
const StyleUtils = useStyleUtils();
45+
const theme = useTheme();
4446
const surfaceBackgroundColor = useSurfaceBackgroundColor();
4547
const pressableRef = useRef<View>(null);
4648
const isCompactPopover = useIsCompactPopover();
@@ -81,10 +83,7 @@ function MenuItemRoot({children, onPress, isDisabled = false, sentryLabel, acces
8183
isCompactPopover && styles.compactPopoverMenuItemBase,
8284
StyleUtils.getButtonBackgroundColorStyle(getButtonState(isHovered, pressed, false, isDisabled, isInteractive), true),
8385
isDisabled && styles.buttonOpacityDisabled,
84-
isHovered &&
85-
isInteractive &&
86-
!pressed &&
87-
(surfaceBackgroundColor ? StyleUtils.getRowHoverBackgroundColorStyle(surfaceBackgroundColor) : styles.hoveredComponentBG),
86+
isHovered && isInteractive && !pressed && StyleUtils.getRowHoverBackgroundColorStyle(surfaceBackgroundColor ?? theme.appBG),
8887
] as StyleProp<ViewStyle>
8988
}
9089
disabled={isDisabled}

src/pages/Search/SearchTypeMenuItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function SearchTypeMenuItem({title, icon, badgeText, focused = false, onPress}:
8686
styles.flexRow,
8787
styles.sectionMenuItem(shouldUseNarrowLayout),
8888
styles.searchTypeMenuItemPadding,
89-
StyleUtils.getButtonBackgroundColorStyle(getButtonState(focused || hovered, false, false, false, true), true),
89+
focused ? StyleUtils.getBackgroundColorStyle(theme.activeComponentBG) : undefined,
9090
hovered && !focused && !pressed && StyleUtils.getRowHoverBackgroundColorStyle(theme.appBG),
9191
// Keep the resting background on press and only dim via opacity, matching the Inbox LHN rows
9292
pressed ? {opacity: variables.pressDimValue} : undefined,

src/styles/utils/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,9 +540,11 @@ const ROW_HOVER_BACKGROUND_STEP: Record<string, string> = {
540540
[colors.productDark100]: colors.productDark200,
541541
[colors.productDark200]: colors.productDark300,
542542
[colors.productDark300]: colors.productDark400,
543+
[colors.productDark400]: colors.productDark500,
543544
[colors.productLight100]: colors.productLight200,
544545
[colors.productLight200]: colors.productLight300,
545546
[colors.productLight300]: colors.productLight400,
547+
[colors.productLight400]: colors.productLight500,
546548
};
547549

548550
function getRowHoverBackgroundColor(backgroundColor: string): string {

0 commit comments

Comments
 (0)