remove unnecessary group component

zio/stable
Samuel Newman 2024-03-20 15:42:39 +00:00
parent 09e9769eea
commit 4c60d4d070
1 changed files with 17 additions and 33 deletions

View File

@ -2,7 +2,6 @@ import React from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import {Trans, msg} from '@lingui/macro' import {Trans, msg} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import flattenReactChildren from 'react-keyed-flatten-children'
import {useAnalytics} from 'lib/analytics/analytics' import {useAnalytics} from 'lib/analytics/analytics'
import {UserAvatar} from '../../view/com/util/UserAvatar' import {UserAvatar} from '../../view/com/util/UserAvatar'
@ -20,30 +19,6 @@ import * as TextField from '#/components/forms/TextField'
import {FormContainer} from './FormContainer' import {FormContainer} from './FormContainer'
import {logEvent} from '#/lib/statsig/statsig' import {logEvent} from '#/lib/statsig/statsig'
function Group({children}: {children: React.ReactNode}) {
const t = useTheme()
return (
<View
style={[
a.rounded_md,
a.overflow_hidden,
a.border,
t.atoms.border_contrast_low,
]}>
{flattenReactChildren(children).map((child, i) => {
return React.isValidElement(child) ? (
<React.Fragment key={i}>
{i > 0 ? (
<View style={[a.border_b, t.atoms.border_contrast_low]} />
) : null}
{child}
</React.Fragment>
) : null
})}
</View>
)
}
function AccountItem({ function AccountItem({
account, account,
onSelect, onSelect,
@ -150,14 +125,23 @@ export const ChooseAccountForm = ({
<TextField.Label> <TextField.Label>
<Trans>Sign in as...</Trans> <Trans>Sign in as...</Trans>
</TextField.Label> </TextField.Label>
<Group> <View
style={[
a.rounded_md,
a.overflow_hidden,
a.border,
t.atoms.border_contrast_low,
]}>
{accounts.map(account => ( {accounts.map(account => (
<>
<AccountItem <AccountItem
key={account.did} key={account.did}
account={account} account={account}
onSelect={onSelect} onSelect={onSelect}
isCurrentAccount={account.did === currentAccount?.did} isCurrentAccount={account.did === currentAccount?.did}
/> />
<View style={[a.border_b, t.atoms.border_contrast_low]} />
</>
))} ))}
<Button <Button
testID="chooseNewAccountBtn" testID="chooseNewAccountBtn"
@ -188,7 +172,7 @@ export const ChooseAccountForm = ({
</View> </View>
)} )}
</Button> </Button>
</Group> </View>
</View> </View>
<View style={[a.flex_row]}> <View style={[a.flex_row]}>
<Button <Button