Skip to content

Commit 8218ef9

Browse files
committed
fix styles for inputs in profile for web
1 parent d699f61 commit 8218ef9

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,11 +1,19 @@
11
import { ControlledField } from '@baca/components'
2+
import { isWeb } from '@baca/constants'
23
import { Button, Text, Spacer, Row, Box } from '@baca/design-system'
3-
import { useCallback, useTranslation, useUpdateProfileForm, useScreenOptions } from '@baca/hooks'
4+
import {
5+
useCallback,
6+
useTranslation,
7+
useUpdateProfileForm,
8+
useScreenOptions,
9+
useWeb,
10+
} from '@baca/hooks'
411
import { useRouter } from 'expo-router'
512

613
export const ProfileScreen = () => {
714
const { t } = useTranslation()
815
const { back } = useRouter()
16+
const { shouldApplyMobileStyles } = useWeb()
917

1018
useScreenOptions({
1119
title: t('navigation.screen_titles.profile'),
@@ -21,36 +29,69 @@ export const ProfileScreen = () => {
2129
<Text.LgBold>Profile</Text.LgBold>
2230
<Text.MdRegular>Update your personal details here.</Text.MdRegular>
2331
<Box borderColor="utility.gray.300" borderBottomWidth={2} borderTopWidth={2} my={4} py={4}>
24-
<ControlledField.Input
25-
{...{ control, errors }}
26-
autoCapitalize="none"
27-
inputMode="text"
28-
label={t('form.labels.first_name')}
29-
name="firstName"
30-
onFocus={focusLastNameInput}
31-
placeholder={t('form.placeholders.email')}
32-
testID="emailInput"
33-
/>
34-
<ControlledField.Input
35-
{...{ control, errors }}
36-
autoCapitalize="none"
37-
inputMode="text"
38-
label={t('form.labels.last_name')}
39-
name="lastName"
40-
placeholder={t('form.placeholders.last_name')}
41-
testID="lastNameInput"
42-
/>
43-
<ControlledField.Input
44-
{...{ control, errors }}
45-
autoCapitalize="none"
46-
inputMode="email"
47-
isDisabled
48-
label={t('form.labels.email')}
49-
name="email"
50-
onSubmitEditing={submit}
51-
placeholder={t('form.placeholders.email')}
52-
testID="emailInput"
53-
/>
32+
<Box
33+
justifyContent="space-between"
34+
flexDirection={isWeb && !shouldApplyMobileStyles ? 'row' : 'column'}
35+
mb={isWeb ? 10 : 0}
36+
>
37+
<Text.SmBold flex={1}>{t('form.labels.first_name')}</Text.SmBold>
38+
<Box flex={isWeb ? 1 : 0}>
39+
<ControlledField.Input
40+
{...{ control, errors }}
41+
autoCapitalize="none"
42+
inputMode="text"
43+
name="firstName"
44+
onFocus={focusLastNameInput}
45+
placeholder={t('form.placeholders.email')}
46+
testID="emailInput"
47+
{...(!isWeb && {
48+
label: t('form.labels.first_name'),
49+
})}
50+
/>
51+
</Box>
52+
</Box>
53+
<Box
54+
justifyContent="space-between"
55+
flexDirection={isWeb && !shouldApplyMobileStyles ? 'row' : 'column'}
56+
mb={isWeb ? 10 : 0}
57+
>
58+
<Text.SmBold flex={1}>{t('form.labels.last_name')}</Text.SmBold>
59+
<Box flex={isWeb ? 1 : 0}>
60+
<ControlledField.Input
61+
{...{ control, errors }}
62+
autoCapitalize="none"
63+
inputMode="text"
64+
name="lastName"
65+
placeholder={t('form.placeholders.last_name')}
66+
testID="lastNameInput"
67+
{...(!isWeb && {
68+
label: t('form.labels.last_name'),
69+
})}
70+
/>
71+
</Box>
72+
</Box>
73+
<Box
74+
justifyContent="space-between"
75+
flexDirection={isWeb && !shouldApplyMobileStyles ? 'row' : 'column'}
76+
mb={isWeb ? 10 : 0}
77+
>
78+
<Text.SmBold flex={1}>{t('form.labels.last_name')}</Text.SmBold>
79+
<Box flex={isWeb ? 1 : 0}>
80+
<ControlledField.Input
81+
{...{ control, errors }}
82+
autoCapitalize="none"
83+
inputMode="email"
84+
isDisabled
85+
name="email"
86+
onSubmitEditing={submit}
87+
placeholder={t('form.placeholders.email')}
88+
testID="emailInput"
89+
{...(!isWeb && {
90+
label: t('form.labels.email'),
91+
})}
92+
/>
93+
</Box>
94+
</Box>
5495
</Box>
5596
<Row justifyContent="flex-end">
5697
<Button.SecondaryColor

0 commit comments

Comments
 (0)