Skip to content

Commit 397efdb

Browse files
Merge pull request #52 from binarapps/fix/input-styles-in-profile
fix styles for inputs in profile for web
2 parents 9f2bfc3 + b10aeeb commit 397efdb

1 file changed

Lines changed: 72 additions & 31 deletions

File tree

src/screens/ProfileScreen.tsx

Lines changed: 72 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
import { useAuthControllerDelete } from '@baca/api/query/auth/auth'
22
import { ControlledField } from '@baca/components'
3+
import { isWeb } from '@baca/constants'
34
import { Button, Text, Spacer, Row, Box, useBottomSheet } from '@baca/design-system'
4-
import { useCallback, useTranslation, useUpdateProfileForm, useScreenOptions } from '@baca/hooks'
5+
import {
6+
useCallback,
7+
useTranslation,
8+
useUpdateProfileForm,
9+
useScreenOptions,
10+
useWeb,
11+
} from '@baca/hooks'
512
import { signOut } from '@baca/store/auth'
613
import { showErrorToast } from '@baca/utils'
714
import { useRouter } from 'expo-router'
815

916
export const ProfileScreen = () => {
1017
const { t } = useTranslation()
1118
const { back } = useRouter()
19+
const { shouldApplyMobileStyles } = useWeb()
1220
const { mutateAsync: removeUserAccount, isLoading } = useAuthControllerDelete()
1321
const { control, errors, isSubmitting, setFocus, submit } = useUpdateProfileForm()
1422

@@ -71,36 +79,69 @@ export const ProfileScreen = () => {
7179
<Text.LgBold>{t('profile_screen.profile')}</Text.LgBold>
7280
<Text.MdRegular>{t('profile_screen.update_your_details')}</Text.MdRegular>
7381
<Box borderColor="utility.gray.300" borderBottomWidth={2} borderTopWidth={2} my={4} py={4}>
74-
<ControlledField.Input
75-
{...{ control, errors }}
76-
autoCapitalize="none"
77-
inputMode="text"
78-
label={t('form.labels.first_name')}
79-
name="firstName"
80-
onFocus={focusLastNameInput}
81-
placeholder={t('form.placeholders.email')}
82-
testID="emailInput"
83-
/>
84-
<ControlledField.Input
85-
{...{ control, errors }}
86-
autoCapitalize="none"
87-
inputMode="text"
88-
label={t('form.labels.last_name')}
89-
name="lastName"
90-
placeholder={t('form.placeholders.last_name')}
91-
testID="lastNameInput"
92-
/>
93-
<ControlledField.Input
94-
{...{ control, errors }}
95-
autoCapitalize="none"
96-
inputMode="email"
97-
isDisabled
98-
label={t('form.labels.email')}
99-
name="email"
100-
onSubmitEditing={submit}
101-
placeholder={t('form.placeholders.email')}
102-
testID="emailInput"
103-
/>
82+
<Box
83+
justifyContent="space-between"
84+
flexDirection={isWeb && !shouldApplyMobileStyles ? 'row' : 'column'}
85+
mb={isWeb ? 10 : 0}
86+
>
87+
<Text.SmBold flex={1}>{t('form.labels.first_name')}</Text.SmBold>
88+
<Box flex={isWeb ? 1 : 0}>
89+
<ControlledField.Input
90+
{...{ control, errors }}
91+
autoCapitalize="none"
92+
inputMode="text"
93+
name="firstName"
94+
onFocus={focusLastNameInput}
95+
placeholder={t('form.placeholders.email')}
96+
testID="emailInput"
97+
{...(!isWeb && {
98+
label: t('form.labels.first_name'),
99+
})}
100+
/>
101+
</Box>
102+
</Box>
103+
<Box
104+
justifyContent="space-between"
105+
flexDirection={isWeb && !shouldApplyMobileStyles ? 'row' : 'column'}
106+
mb={isWeb ? 10 : 0}
107+
>
108+
<Text.SmBold flex={1}>{t('form.labels.last_name')}</Text.SmBold>
109+
<Box flex={isWeb ? 1 : 0}>
110+
<ControlledField.Input
111+
{...{ control, errors }}
112+
autoCapitalize="none"
113+
inputMode="text"
114+
name="lastName"
115+
placeholder={t('form.placeholders.last_name')}
116+
testID="lastNameInput"
117+
{...(!isWeb && {
118+
label: t('form.labels.last_name'),
119+
})}
120+
/>
121+
</Box>
122+
</Box>
123+
<Box
124+
justifyContent="space-between"
125+
flexDirection={isWeb && !shouldApplyMobileStyles ? 'row' : 'column'}
126+
mb={isWeb ? 10 : 0}
127+
>
128+
<Text.SmBold flex={1}>{t('form.labels.last_name')}</Text.SmBold>
129+
<Box flex={isWeb ? 1 : 0}>
130+
<ControlledField.Input
131+
{...{ control, errors }}
132+
autoCapitalize="none"
133+
inputMode="email"
134+
isDisabled
135+
name="email"
136+
onSubmitEditing={submit}
137+
placeholder={t('form.placeholders.email')}
138+
testID="emailInput"
139+
{...(!isWeb && {
140+
label: t('form.labels.email'),
141+
})}
142+
/>
143+
</Box>
144+
</Box>
104145
</Box>
105146
<Row justifyContent="flex-end">
106147
<Button.SecondaryColor

0 commit comments

Comments
 (0)