tweak hover state (#5892)

This commit is contained in:
Samuel Newman
2024-10-21 21:21:08 +03:00
committed by GitHub
parent f6649e22a7
commit 090ac041c3
+26 -31
View File
@@ -226,7 +226,6 @@ let DrawerContent = ({}: {}): React.ReactNode => {
<ScrollView <ScrollView
style={[a.flex_1]} style={[a.flex_1]}
contentContainerStyle={[ contentContainerStyle={[
a.px_xl,
{ {
paddingTop: Math.max( paddingTop: Math.max(
insets.top + a.pt_xl.paddingTop, insets.top + a.pt_xl.paddingTop,
@@ -234,6 +233,7 @@ let DrawerContent = ({}: {}): React.ReactNode => {
), ),
}, },
]}> ]}>
<View style={[a.px_xl]}>
{hasSession && currentAccount ? ( {hasSession && currentAccount ? (
<DrawerProfileCard <DrawerProfileCard
account={currentAccount} account={currentAccount}
@@ -246,6 +246,7 @@ let DrawerContent = ({}: {}): React.ReactNode => {
)} )}
<Divider style={[a.mt_xl, a.mb_sm]} /> <Divider style={[a.mt_xl, a.mb_sm]} />
</View>
{hasSession ? ( {hasSession ? (
<> <>
@@ -272,6 +273,7 @@ let DrawerContent = ({}: {}): React.ReactNode => {
</> </>
)} )}
<View style={[a.px_xl]}>
<Divider style={[a.mb_xl, a.mt_sm]} /> <Divider style={[a.mb_xl, a.mt_sm]} />
<View style={[a.flex_col, a.gap_md, a.flex_wrap]}> <View style={[a.flex_col, a.gap_md, a.flex_wrap]}>
@@ -301,6 +303,7 @@ let DrawerContent = ({}: {}): React.ReactNode => {
</Text> </Text>
)} )}
</View> </View>
</View>
</ScrollView> </ScrollView>
<DrawerFooter <DrawerFooter
@@ -387,8 +390,6 @@ let SearchMenuItem = ({
) )
} }
label={_(msg`Search`)} label={_(msg`Search`)}
accessibilityLabel={_(msg`Search`)}
accessibilityHint=""
bold={isActive} bold={isActive}
onPress={onPress} onPress={onPress}
/> />
@@ -415,8 +416,6 @@ let HomeMenuItem = ({
) )
} }
label={_(msg`Home`)} label={_(msg`Home`)}
accessibilityLabel={_(msg`Home`)}
accessibilityHint=""
bold={isActive} bold={isActive}
onPress={onPress} onPress={onPress}
/> />
@@ -443,8 +442,6 @@ let ChatMenuItem = ({
) )
} }
label={_(msg`Chat`)} label={_(msg`Chat`)}
accessibilityLabel={_(msg`Chat`)}
accessibilityHint=""
bold={isActive} bold={isActive}
onPress={onPress} onPress={onPress}
/> />
@@ -472,7 +469,6 @@ let NotificationsMenuItem = ({
) )
} }
label={_(msg`Notifications`)} label={_(msg`Notifications`)}
accessibilityLabel={_(msg`Notifications`)}
accessibilityHint={ accessibilityHint={
numUnreadNotifications === '' numUnreadNotifications === ''
? '' ? ''
@@ -505,8 +501,6 @@ let FeedsMenuItem = ({
) )
} }
label={_(msg`Feeds`)} label={_(msg`Feeds`)}
accessibilityLabel={_(msg`Feeds`)}
accessibilityHint=""
bold={isActive} bold={isActive}
onPress={onPress} onPress={onPress}
/> />
@@ -522,8 +516,6 @@ let ListsMenuItem = ({onPress}: {onPress: () => void}): React.ReactNode => {
<MenuItem <MenuItem
icon={<List style={[t.atoms.text]} width={iconWidth} />} icon={<List style={[t.atoms.text]} width={iconWidth} />}
label={_(msg`Lists`)} label={_(msg`Lists`)}
accessibilityLabel={_(msg`Lists`)}
accessibilityHint=""
onPress={onPress} onPress={onPress}
/> />
) )
@@ -549,8 +541,6 @@ let ProfileMenuItem = ({
) )
} }
label={_(msg`Profile`)} label={_(msg`Profile`)}
accessibilityLabel={_(msg`Profile`)}
accessibilityHint=""
onPress={onPress} onPress={onPress}
/> />
) )
@@ -564,32 +554,30 @@ let SettingsMenuItem = ({onPress}: {onPress: () => void}): React.ReactNode => {
<MenuItem <MenuItem
icon={<Settings style={[t.atoms.text]} width={iconWidth} />} icon={<Settings style={[t.atoms.text]} width={iconWidth} />}
label={_(msg`Settings`)} label={_(msg`Settings`)}
accessibilityLabel={_(msg`Settings`)}
accessibilityHint=""
onPress={onPress} onPress={onPress}
/> />
) )
} }
SettingsMenuItem = React.memo(SettingsMenuItem) SettingsMenuItem = React.memo(SettingsMenuItem)
function MenuItem({ function MenuItem({icon, label, count, bold, onPress}: MenuItemProps) {
icon,
label,
accessibilityLabel,
count,
bold,
onPress,
}: MenuItemProps) {
const t = useTheme() const t = useTheme()
return ( return (
<PressableScale <Button
testID={`menuItemButton-${label}`} testID={`menuItemButton-${label}`}
style={[a.flex_row, a.align_center, a.gap_sm, {paddingVertical: 10}]}
onPress={onPress} onPress={onPress}
accessibilityRole="tab" accessibilityRole="tab"
accessibilityLabel={accessibilityLabel} label={label}>
accessibilityHint="" {({hovered, pressed}) => (
targetScale={0.95}> <View
style={[
a.flex_1,
a.flex_row,
a.gap_md,
a.py_md,
a.px_xl,
(hovered || pressed) && t.atoms.bg_contrast_25,
]}>
<View style={[a.relative]}> <View style={[a.relative]}>
{icon} {icon}
{count ? ( {count ? (
@@ -628,10 +616,17 @@ function MenuItem({
) : undefined} ) : undefined}
</View> </View>
<Text <Text
style={[a.flex_1, a.text_2xl, bold && a.font_bold, web(a.leading_snug)]} style={[
a.flex_1,
a.text_2xl,
bold && a.font_heavy,
web(a.leading_snug),
]}
numberOfLines={1}> numberOfLines={1}>
{label} {label}
</Text> </Text>
</PressableScale> </View>
)}
</Button>
) )
} }