diff --git a/src/frontend/js/components/AddressesManagement/AddressForm/index.tsx b/src/frontend/js/components/AddressesManagement/AddressForm/index.tsx index 87279b56b2..97b37dcc29 100644 --- a/src/frontend/js/components/AddressesManagement/AddressForm/index.tsx +++ b/src/frontend/js/components/AddressesManagement/AddressForm/index.tsx @@ -10,6 +10,7 @@ import Input from 'components/Form/Input'; import { useAddresses } from 'hooks/useAddresses'; import type { Address } from 'types/Joanie'; import { messages as formMessages } from 'components/Form/messages'; +import Form from 'components/Form'; import validationSchema from './validationSchema'; export interface AddressFormValues extends Omit { @@ -60,11 +61,11 @@ const AddressForm = ({ handleReset, onSubmit, address }: Props) => { return ( -
+

-
+ { name="title" label={intl.formatMessage(messages.titleInputLabel)} /> -
-
+ + { name="last_name" label={intl.formatMessage(messages.last_nameInputLabel)} /> -
-
+ + -
-
+ + { name="city" label={intl.formatMessage(messages.cityInputLabel)} /> -
-
+ + -
+ {!address ? ( -
+ { )} {...register('save')} /> -
+ ) : null}
@@ -155,7 +156,7 @@ const AddressForm = ({ handleReset, onSubmit, address }: Props) => { )}
-
+
); }; diff --git a/src/frontend/js/components/Form/Form/_styles.scss b/src/frontend/js/components/Form/Form/_styles.scss index 99dc35bb0a..6b2da81978 100644 --- a/src/frontend/js/components/Form/Form/_styles.scss +++ b/src/frontend/js/components/Form/Form/_styles.scss @@ -1,12 +1,11 @@ -// -// Form objects -// - // Example of a form class structure: // .form // .form-row // .c__field ( should be form-field when cunningham is improved) .form { + $vertical-spacing: rem-calc(10px); + $horizontal-spacing: rem-calc(16px); + .c__field { width: auto; display: flex; @@ -16,8 +15,8 @@ &-row { display: flex; flex-direction: row; - gap: rem-calc(16px); - margin-bottom: rem-calc(10px); + gap: $horizontal-spacing; + margin-bottom: $vertical-spacing; &:last-child { margin-bottom: 0; } diff --git a/src/frontend/js/hooks/useDashboardAddressForm.tsx b/src/frontend/js/hooks/useDashboardAddressForm.tsx index 1a76b65ca1..f3dd2e7f69 100644 --- a/src/frontend/js/hooks/useDashboardAddressForm.tsx +++ b/src/frontend/js/hooks/useDashboardAddressForm.tsx @@ -11,6 +11,7 @@ import { messages as formMessages } from 'components/Form/messages'; import { CountrySelectField } from 'components/Form/CountrySelectField'; import Input from 'components/Form/Input'; import { Address } from 'types/Joanie'; +import Form from 'components/Form'; const messages = defineMessages({ isMainInputLabel: { @@ -64,19 +65,19 @@ export const useDashboardAddressForm = (address?: Address) => { const FormView = ( -
+

-
+ -
-
+ + { name="last_name" label={intl.formatMessage(managementMessages.last_nameInputLabel)} /> -
-
+ + -
+ -
+ { name="city" label={intl.formatMessage(managementMessages.cityInputLabel)} /> -
-
+ + -
+ {!(address && address.is_main) && ( { {...register('is_main')} /> )} - +
); diff --git a/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.tsx b/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.tsx index bb9d939a2b..9192341ac6 100644 --- a/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.tsx +++ b/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.tsx @@ -10,6 +10,7 @@ import { Spinner } from 'components/Spinner'; import Banner, { BannerType } from 'components/Banner'; import { useCreditCardsManagement } from 'hooks/useCreditCardsManagement'; import { noop } from 'utils'; +import Form from 'components/Form'; import { CreditCardBrandLogo } from './CreditCardBrandLogo'; const messages = defineMessages({ @@ -116,11 +117,11 @@ export const DashboardEditCreditCard = ({ creditCard, onSettled = noop }: Props) } return ( -
-
+ + -
-
+ +
- + {!creditCard.is_main && ( -
+ -
+ )} -
+
); };