From 21c9d9410a5fa127c6903ef559ed7829a11ada81 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Tue, 1 Nov 2022 21:17:18 +0800 Subject: [PATCH] [offers][feat] tweak offer details submission form (#488) --- .../offersSubmission/OffersSubmissionForm.tsx | 7 +- .../submissionForm/OfferDetailsForm.tsx | 576 +++++++++--------- .../HorizontalDivider/HorizontalDivider.tsx | 2 +- 3 files changed, 301 insertions(+), 284 deletions(-) diff --git a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx index 325c9afc..440e2686 100644 --- a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx +++ b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx @@ -275,16 +275,17 @@ export default function OffersSubmissionForm({ /> -
+ {steps[step]} - {/*
{JSON.stringify(formMethods.watch(), null, 2)}
*/} {step === 0 && (
+ )} - + ); } @@ -308,26 +326,23 @@ function InternshipOfferDetailsForm({ }); return ( -
-
-
- { - if (option) { - setValue(`offers.${index}.offersIntern.title`, option.value); - } - }} - /> -
-
-
-
+
+
+ { + if (option) { + setValue(`offers.${index}.offersIntern.title`, option.value); + } + }} + /> + +
+
- -
-
- - -
-
- -
-
- - } - endAddOnType="element" - errorMessage={ - offerFields?.offersIntern?.monthlySalary?.value?.message - } - label="Salary (Monthly)" - placeholder="0" - required={true} - startAddOn="$" - startAddOnType="label" - type="number" - {...register(`offers.${index}.offersIntern.monthlySalary.value`, { - min: { message: FieldError.NON_NEGATIVE_NUMBER, value: 0 }, - required: FieldError.REQUIRED, - valueAsNumber: true, - })} - /> -
-
+
+ + +
+ +
+
+ + + } + endAddOnType="element" + errorMessage={ + offerFields?.offersIntern?.monthlySalary?.value?.message + } + label="Salary (Monthly)" + placeholder="0" + required={true} + startAddOn="$" + startAddOnType="label" + type="number" + {...register(`offers.${index}.offersIntern.monthlySalary.value`, { + min: { message: FieldError.NON_NEGATIVE_NUMBER, value: 0 }, + required: FieldError.REQUIRED, + valueAsNumber: true, + })} + /> +
+
+
-
-
-
-
- {index > 0 && ( -
+ + {index > 0 && ( +
+ +
+
+
+ )}
); } @@ -466,7 +482,7 @@ function OfferDetailsFormArray({ const { append, remove, fields } = fieldArrayValues; return ( -
+
{fields.map((item, index) => { return (
@@ -483,7 +499,7 @@ function OfferDetailsFormArray({ icon={PlusIcon} label="Add another offer" size="lg" - variant="tertiary" + variant="secondary" onClick={() => append( jobType === JobType.FULLTIME @@ -524,7 +540,7 @@ export default function OfferDetailsForm({ jobType === JobType.FULLTIME ? JobTypeLabel.INTERN : JobTypeLabel.FULLTIME; return ( -
+
Fill in your offer details
diff --git a/packages/ui/src/HorizontalDivider/HorizontalDivider.tsx b/packages/ui/src/HorizontalDivider/HorizontalDivider.tsx index 6e2396dc..c9f3d2b1 100644 --- a/packages/ui/src/HorizontalDivider/HorizontalDivider.tsx +++ b/packages/ui/src/HorizontalDivider/HorizontalDivider.tsx @@ -8,7 +8,7 @@ export default function HorizontalDivider({ className }: Props) { return (
); }