1- import { ControlledField } from '@baca/components'
2- import { isWeb } from '@baca/constants'
3- import { Text , Box , Button , Spacer , Row } from '@baca/design-system'
4- import { useCallback , useTranslation , useUpdateProfileForm , useWeb } from '@baca/hooks'
1+ import { Box , Button , Spacer , Row } from '@baca/design-system'
2+ import { useUpdateProfileForm } from '@baca/hooks'
53import { useRouter } from 'expo-router'
4+ import { useCallback } from 'react'
5+ import { useTranslation } from 'react-i18next'
6+
7+ import { ProfileControlledInput } from './ProfileControlledInput'
68
79export const ProfileDetailsForm = ( ) => {
810 const { t } = useTranslation ( )
9- const { shouldApplyMobileStyles } = useWeb ( )
1011 const { control, errors, setFocus, submit, isSubmitting } = useUpdateProfileForm ( )
1112 const { back } = useRouter ( )
1213
@@ -15,72 +16,30 @@ export const ProfileDetailsForm = () => {
1516 return (
1617 < Box >
1718 < Box borderColor = "border.secondary" borderTopWidth = { 1 } py = { 6 } >
18- < Box
19- justifyContent = "space-between"
20- flexDirection = { isWeb && ! shouldApplyMobileStyles ? 'row' : 'column' }
21- mb = { isWeb ? 10 : 0 }
22- maxW = { 800 }
23- >
24- < Text . SmBold flex = { 1 } > { t ( 'form.labels.first_name' ) } </ Text . SmBold >
25- < Box flex = { isWeb ? 2 : 0 } >
26- < ControlledField . Input
27- { ...{ control, errors } }
28- autoCapitalize = "none"
29- inputMode = "text"
30- name = "firstName"
31- onFocus = { focusLastNameInput }
32- placeholder = { t ( 'form.placeholders.first_name' ) }
33- testID = "firstNameInput"
34- { ...( ! isWeb && {
35- label : t ( 'form.labels.first_name' ) ,
36- } ) }
37- />
38- </ Box >
39- </ Box >
40- < Box
41- justifyContent = "space-between"
42- flexDirection = { isWeb && ! shouldApplyMobileStyles ? 'row' : 'column' }
43- mb = { isWeb ? 10 : 0 }
44- maxW = { 800 }
45- >
46- < Text . SmBold flex = { 1 } > { t ( 'form.labels.last_name' ) } </ Text . SmBold >
47- < Box flex = { isWeb ? 2 : 0 } >
48- < ControlledField . Input
49- { ...{ control, errors } }
50- autoCapitalize = "none"
51- inputMode = "text"
52- name = "lastName"
53- placeholder = { t ( 'form.placeholders.last_name' ) }
54- testID = "lastNameInput"
55- { ...( ! isWeb && {
56- label : t ( 'form.labels.last_name' ) ,
57- } ) }
58- />
59- </ Box >
60- </ Box >
61- < Box
62- justifyContent = "space-between"
63- flexDirection = { isWeb && ! shouldApplyMobileStyles ? 'row' : 'column' }
64- mb = { isWeb ? 10 : 0 }
65- maxW = { 800 }
66- >
67- < Text . SmBold flex = { 1 } > { t ( 'form.labels.email' ) } </ Text . SmBold >
68- < Box flex = { isWeb ? 2 : 0 } >
69- < ControlledField . Input
70- { ...{ control, errors } }
71- autoCapitalize = "none"
72- inputMode = "email"
73- isDisabled
74- name = "email"
75- onSubmitEditing = { submit }
76- placeholder = { t ( 'form.placeholders.email' ) }
77- testID = "emailInput"
78- { ...( ! isWeb && {
79- label : t ( 'form.labels.email' ) ,
80- } ) }
81- />
82- </ Box >
83- </ Box >
19+ < ProfileControlledInput
20+ label = { t ( 'form.labels.first_name' ) }
21+ name = "firstName"
22+ placeholder = { t ( 'form.placeholders.first_name' ) }
23+ control = { control }
24+ errors = { errors }
25+ onFocus = { focusLastNameInput }
26+ />
27+ < ProfileControlledInput
28+ label = { t ( 'form.labels.last_name' ) }
29+ name = "lastName"
30+ placeholder = { t ( 'form.placeholders.last_name' ) }
31+ control = { control }
32+ errors = { errors }
33+ />
34+ < ProfileControlledInput
35+ label = { t ( 'form.labels.email' ) }
36+ name = "email"
37+ placeholder = { t ( 'form.placeholders.email' ) }
38+ control = { control }
39+ errors = { errors }
40+ isDisabled
41+ onSubmitEditing = { submit }
42+ />
8443 < Row maxW = { 800 } justifyContent = "flex-end" >
8544 < Button . SecondaryColor
8645 disabled = { isSubmitting }
0 commit comments