Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/HighlightableMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function HighlightableMenuItem({wrapperStyle, highlighted, ...restOfProps}: Prop
const flattenedWrapperStyles = StyleSheet.flatten(wrapperStyle);
const animatedHighlightStyle = useAnimatedHighlightStyle({
shouldHighlight: highlighted ?? false,
height: flattenedWrapperStyles?.height ? Number(flattenedWrapperStyles.height) : styles.sectionMenuItem.height,
borderRadius: flattenedWrapperStyles?.borderRadius ? Number(flattenedWrapperStyles.borderRadius) : styles.sectionMenuItem.borderRadius,
height: flattenedWrapperStyles?.height ? Number(flattenedWrapperStyles.height) : styles.sectionMenuItem(true).height,
borderRadius: flattenedWrapperStyles?.borderRadius ? Number(flattenedWrapperStyles.borderRadius) : styles.sectionMenuItem(true).borderRadius,
highlightColor: theme.messageHighlightBG,
highlightEndDelay: CONST.ANIMATED_HIGHLIGHT_WORKSPACE_FEATURE_ITEM_END_DELAY,
highlightEndDuration: CONST.ANIMATED_HIGHLIGHT_WORKSPACE_FEATURE_ITEM_END_DURATION,
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Search/SavedSearchList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import useFeedKeysWithAssignedCards from '@hooks/useFeedKeysWithAssignedCards';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import {setSearchContext} from '@libs/actions/Search';
import {mergeCardListWithWorkspaceFeeds} from '@libs/CardUtils';
Expand All @@ -32,6 +33,7 @@ type SavedSearchListProps = {
function SavedSearchList({hash}: SavedSearchListProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const isFocused = useIsFocused();

const [savedSearches] = useOnyx(ONYXKEYS.SAVED_SEARCHES);
Expand Down Expand Up @@ -113,7 +115,7 @@ function SavedSearchList({hash}: SavedSearchListProps) {
return (
<MenuItemList
menuItems={savedSearchesMenuItems}
wrapperStyle={styles.sectionMenuItem}
wrapperStyle={styles.sectionMenuItem(shouldUseNarrowLayout)}
icon={expensifyIcons.Bookmark}
iconWidth={variables.iconSizeNormal}
iconHeight={variables.iconSizeNormal}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Search/SearchTypeMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Badge from '@components/Badge';
import Icon from '@components/Icon';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import Text from '@components/Text';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import getButtonState from '@libs/getButtonState';
Expand Down Expand Up @@ -34,6 +35,7 @@ type SearchTypeMenuItemProps = {
function SearchTypeMenuItem({title, icon, badgeText, focused = false, onPress}: SearchTypeMenuItemProps) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const {shouldUseNarrowLayout} = useResponsiveLayout();

return (
<PressableWithoutFeedback
Expand All @@ -43,7 +45,7 @@ function SearchTypeMenuItem({title, icon, badgeText, focused = false, onPress}:
sentryLabel={CONST.SENTRY_LABEL.SEARCH.TYPE_MENU_ITEM}
style={({hovered, pressed}) => [
styles.flexRow,
styles.sectionMenuItem,
styles.sectionMenuItem(shouldUseNarrowLayout),
StyleUtils.getButtonBackgroundColorStyle(getButtonState(focused || hovered, pressed, false, false, true), true),
hovered && !focused && !pressed && styles.hoveredComponentBG,
]}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Search/SuggestedSearchSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
import variables from '@styles/variables';

const SUGGESTED_SEARCH_SKELETON_TEST_ID = 'SuggestedSearchSkeleton';
const NAV_ITEM_HEIGHT = 52;
const NAV_ITEM_HEIGHT = variables.sectionMenuItemHeightCompact;
const SECTION_MENU_ITEM_HORIZONTAL_PADDING = 16;
const SECTION_HEADER_HEIGHT = 32;
const SECTION_HEADER_RECT_HEIGHT = 4;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/domain/DomainInitialPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function DomainInitialPage({route}: DomainInitialPageProps) {
icon={item.icon}
onPress={item.action}
brickRoadIndicator={item.brickRoadIndicator}
wrapperStyle={styles.sectionMenuItem}
wrapperStyle={styles.sectionMenuItem(shouldUseNarrowLayout)}
highlighted={!!item?.highlighted}
focused={!!(item.screenName && activeRoute?.startsWith(item.screenName))}
badgeText={item.badgeText}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/InitialSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
return (
<MenuItem
key={keyTitle}
wrapperStyle={styles.sectionMenuItem}
wrapperStyle={styles.sectionMenuItem(shouldUseNarrowLayout)}
title={keyTitle}
icon={item.icon}
iconType={item.iconType}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceInitialPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac
icon={item.icon}
onPress={item.action}
brickRoadIndicator={item.brickRoadIndicator}
wrapperStyle={styles.sectionMenuItem}
wrapperStyle={styles.sectionMenuItem(shouldUseNarrowLayout)}
highlighted={!!item?.highlighted}
focused={!!(item.screenName && activeRoute?.startsWith(item.screenName))}
badgeText={item.badgeText}
Expand Down
16 changes: 8 additions & 8 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2824,14 +2824,6 @@ const staticStyles = (theme: ThemeColors) =>
borderRadius: variables.componentBorderRadiusLarge,
},

sectionMenuItem: {
borderRadius: 8,
paddingHorizontal: 16,
paddingVertical: 8,
height: 52,
alignItems: 'center',
},

sectionSelectCircle: {
backgroundColor: theme.cardBG,
},
Expand Down Expand Up @@ -6246,6 +6238,14 @@ const dynamicStyles = (theme: ThemeColors) =>
getEmptyStateCompanyCardsIllustrationContainer: (shouldUseNarrowLayout: boolean) => (shouldUseNarrowLayout ? {height: 220} : {aspectRatio: 680 / 220}),

getEmptyStateCompanyCardsIllustration: (shouldUseNarrowLayout: boolean) => (shouldUseNarrowLayout ? {width: 680, height: 220} : {}),

sectionMenuItem: (shouldUseNarrowLayout: boolean) => ({
borderRadius: 8,
paddingHorizontal: 16,
paddingVertical: shouldUseNarrowLayout ? 8 : 4,
height: shouldUseNarrowLayout ? variables.sectionMenuItemHeight : variables.sectionMenuItemHeightCompact,
alignItems: 'center',
}),
}) satisfies DynamicStyles;

// Styles that cannot be wrapped in StyleSheet.create because they eg. must be passed to 3rd party libraries as JS objects
Expand Down
2 changes: 2 additions & 0 deletions src/styles/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ export default {
gutterWidth: 12,
optionRowHeight: 64,
optionRowHeightCompact: 52,
sectionMenuItemHeight: 52,
sectionMenuItemHeightCompact: 44,
optionsListSectionHeaderHeight: getValueUsingPixelRatio(32, 38),
overlayOpacity: 0.72,
lineHeightXSmall: getValueUsingPixelRatio(11, 17),
Expand Down
Loading