buttons in account switcher

This commit is contained in:
Hailey
2024-10-01 19:49:45 -07:00
parent 8bd6b2d6b5
commit 65bfd89d88
+9 -9
View File
@@ -7,9 +7,9 @@ import {useProfileQuery} from '#/state/queries/profile'
import {type SessionAccount, useSession} from '#/state/session' import {type SessionAccount, useSession} from '#/state/session'
import {UserAvatar} from '#/view/com/util/UserAvatar' import {UserAvatar} from '#/view/com/util/UserAvatar'
import {atoms as a, useTheme} from '#/alf' import {atoms as a, useTheme} from '#/alf'
import {BottomSheetButton} from '#/components/BottomSheetButton'
import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check' import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check'
import {ChevronRight_Stroke2_Corner0_Rounded as Chevron} from '#/components/icons/Chevron' import {ChevronRight_Stroke2_Corner0_Rounded as Chevron} from '#/components/icons/Chevron'
import {Button} from './Button'
import {Text} from './Typography' import {Text} from './Typography'
export function AccountList({ export function AccountList({
@@ -51,19 +51,19 @@ export function AccountList({
<View style={[{borderBottomWidth: 1}, t.atoms.border_contrast_low]} /> <View style={[{borderBottomWidth: 1}, t.atoms.border_contrast_low]} />
</React.Fragment> </React.Fragment>
))} ))}
<Button <BottomSheetButton
testID="chooseAddAccountBtn" testID="chooseAddAccountBtn"
style={[a.flex_1]} style={[a.flex_1]}
onPress={pendingDid ? undefined : onPressAddAccount} onPress={pendingDid ? undefined : onPressAddAccount}
label={_(msg`Login to account that is not listed`)}> label={_(msg`Login to account that is not listed`)}>
{({hovered, pressed}) => ( {({pressed}) => (
<View <View
style={[ style={[
a.flex_1, a.flex_1,
a.flex_row, a.flex_row,
a.align_center, a.align_center,
{height: 48}, {height: 48},
(hovered || pressed) && t.atoms.bg_contrast_25, pressed && t.atoms.bg_contrast_25,
]}> ]}>
<Text <Text
style={[ style={[
@@ -78,7 +78,7 @@ export function AccountList({
<Chevron size="sm" style={[t.atoms.text, a.mr_md]} /> <Chevron size="sm" style={[t.atoms.text, a.mr_md]} />
</View> </View>
)} )}
</Button> </BottomSheetButton>
</View> </View>
) )
} }
@@ -103,7 +103,7 @@ function AccountItem({
}, [account, onSelect]) }, [account, onSelect])
return ( return (
<Button <BottomSheetButton
testID={`chooseAccountBtn-${account.handle}`} testID={`chooseAccountBtn-${account.handle}`}
key={account.did} key={account.did}
style={[a.flex_1]} style={[a.flex_1]}
@@ -113,14 +113,14 @@ function AccountItem({
? _(msg`Continue as ${account.handle} (currently signed in)`) ? _(msg`Continue as ${account.handle} (currently signed in)`)
: _(msg`Sign in as ${account.handle}`) : _(msg`Sign in as ${account.handle}`)
}> }>
{({hovered, pressed}) => ( {({pressed}) => (
<View <View
style={[ style={[
a.flex_1, a.flex_1,
a.flex_row, a.flex_row,
a.align_center, a.align_center,
{height: 48}, {height: 48},
(hovered || pressed || isPendingAccount) && t.atoms.bg_contrast_25, (pressed || isPendingAccount) && t.atoms.bg_contrast_25,
]}> ]}>
<View style={a.p_md}> <View style={a.p_md}>
<UserAvatar avatar={profile?.avatar} size={24} /> <UserAvatar avatar={profile?.avatar} size={24} />
@@ -143,6 +143,6 @@ function AccountItem({
)} )}
</View> </View>
)} )}
</Button> </BottomSheetButton>
) )
} }