diff --git a/apps/portal/src/components/offers/Breadcrumb.tsx b/apps/portal/src/components/offers/Breadcrumb.tsx index 30eb07b4..d303070d 100644 --- a/apps/portal/src/components/offers/Breadcrumb.tsx +++ b/apps/portal/src/components/offers/Breadcrumb.tsx @@ -1,45 +1,50 @@ -export type BreadcrumbStep = { +import clsx from 'clsx'; +import { ChevronRightIcon } from '@heroicons/react/20/solid'; + +export type BreadcrumbStep = Readonly<{ label: string; step?: number; -}; +}>; type BreadcrumbsProps = Readonly<{ currentStep: number; setStep: (nextStep: number) => void; - steps: Array; + steps: ReadonlyArray; }>; -function getPrimaryText(text: string) { - return

{text}

; -} - -function getSlateText(text: string) { - return

{text}

; -} - -function getTextWithLink(text: string, onClickHandler: () => void) { - return ( -

- {text} -

- ); -} - export function Breadcrumbs({ steps, currentStep, setStep }: BreadcrumbsProps) { return ( -
- {steps.map(({ label, step }, index) => ( -
- {step === currentStep - ? getPrimaryText(label) - : step !== undefined - ? getTextWithLink(label, () => setStep(step)) - : getSlateText(label)} - {index !== steps.length - 1 && getSlateText('>')} -
- ))} -
+ ); } diff --git a/apps/portal/src/components/offers/forms/FormSection.tsx b/apps/portal/src/components/offers/forms/FormSection.tsx new file mode 100644 index 00000000..e83b8c70 --- /dev/null +++ b/apps/portal/src/components/offers/forms/FormSection.tsx @@ -0,0 +1,18 @@ +import { HorizontalDivider } from '@tih/ui'; + +export default function FormSection({ + children, + title, +}: Readonly<{ children: React.ReactNode; title: string }>) { + return ( +
+
+

+ {title} +

+ +
+
{children}
+
+ ); +} diff --git a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx index 440e2686..7197e847 100644 --- a/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx +++ b/apps/portal/src/components/offers/offersSubmission/OffersSubmissionForm.tsx @@ -264,65 +264,69 @@ export default function OffersSubmissionForm({ }, []); return ( -
-
-
-
+
+
+
+
- -
- {steps[step]} - {step === 0 && ( -
-
- )} - {step === 1 && ( -
-
- )} -
-
+
+ +
+ {steps[step]} + {step === 0 && ( +
+
+ )} + {step === 1 && ( +
+
+ )} +
+
+
diff --git a/apps/portal/src/components/offers/offersSubmission/submissionForm/BackgroundForm.tsx b/apps/portal/src/components/offers/offersSubmission/submissionForm/BackgroundForm.tsx index fc5bb109..d0d718ba 100644 --- a/apps/portal/src/components/offers/offersSubmission/submissionForm/BackgroundForm.tsx +++ b/apps/portal/src/components/offers/offersSubmission/submissionForm/BackgroundForm.tsx @@ -21,6 +21,7 @@ import { } from '~/utils/offers/currency/CurrencyEnum'; import FormRadioList from '../../forms/FormRadioList'; +import FormSection from '../../forms/FormSection'; import FormSelect from '../../forms/FormSelect'; import FormTextInput from '../../forms/FormTextInput'; @@ -29,29 +30,26 @@ function YoeSection() { background: BackgroundPostData; }>(); const backgroundFields = formState.errors.background; - return ( - <> -
- Years of Experience (YOE) -
-
-
- -
- -
+ return ( + +
+ +
+ +
+
-
+
- -
- +
+
+
); } @@ -107,38 +105,34 @@ function FullTimeJobFields() { return ( <> -
-
- { - if (option) { - setValue('background.experiences.0.title', option.value); - } - }} - /> -
-
- { - if (option) { - setValue('background.experiences.0.companyId', option.value); - setValue('background.experiences.0.companyName', option.label); - } - }} - /> -
+
+ { + if (option) { + setValue('background.experiences.0.title', option.value); + } + }} + /> + { + if (option) { + setValue('background.experiences.0.companyId', option.value); + setValue('background.experiences.0.companyName', option.label); + } + }} + />
-
+
-
+
-
-
-
-
- { - if (option) { - setValue('background.experiences.0.title', option.value); - } - }} - /> -
-
- { - if (option) { - setValue('background.experiences.0.companyId', option.value); - setValue('background.experiences.0.companyName', option.label); - } - }} - /> -
-
-
- - } - endAddOnType="element" - errorMessage={experiencesField?.monthlySalary?.value?.message} - label="Salary (Monthly)" - placeholder="0.00" - startAddOn="$" - startAddOnType="label" - type="number" - {...register(`background.experiences.0.monthlySalary.value`, { - min: { message: FieldError.NON_NEGATIVE_NUMBER, value: 0 }, - valueAsNumber: true, - })} +
+ { + if (option) { + setValue('background.experiences.0.title', option.value); + } + }} + /> + { + if (option) { + setValue('background.experiences.0.companyId', option.value); + setValue('background.experiences.0.companyName', option.label); + } + }} />
- -
+ -
+ } + endAddOnType="element" + errorMessage={experiencesField?.monthlySalary?.value?.message} + label="Salary (Monthly)" + placeholder="0.00" + startAddOn="$" + startAddOnType="label" + type="number" + {...register(`background.experiences.0.monthlySalary.value`, { + min: { message: FieldError.NON_NEGATIVE_NUMBER, value: 0 }, + valueAsNumber: true, + })} + /> + + ); @@ -291,85 +275,71 @@ function CurrentJobSection() { }); return ( - <> -
- Current / Previous Job -
-
-
- - - - -
- {watchJobType === JobType.FULLTIME ? ( - - ) : ( - - )} -
- + + + + + + {watchJobType === JobType.FULLTIME ? ( + + ) : ( + + )} + ); } function EducationSection() { const { register } = useFormContext(); return ( - <> -
- Education -
-
-
- - -
- -
- -
-
+ +
+ +
- + + + +
); } export default function BackgroundForm() { return ( -
-
+
+

Help us better gauge your offers -

-
+
+
diff --git a/apps/portal/src/components/offers/offersSubmission/submissionForm/OfferDetailsForm.tsx b/apps/portal/src/components/offers/offersSubmission/submissionForm/OfferDetailsForm.tsx index 091a9431..b1a438f7 100644 --- a/apps/portal/src/components/offers/offersSubmission/submissionForm/OfferDetailsForm.tsx +++ b/apps/portal/src/components/offers/offersSubmission/submissionForm/OfferDetailsForm.tsx @@ -29,6 +29,7 @@ import { yearOptions, } from '../../constants'; import FormMonthYearPicker from '../../forms/FormMonthYearPicker'; +import FormSection from '../../forms/FormSection'; import FormSelect from '../../forms/FormSelect'; import FormTextArea from '../../forms/FormTextArea'; import FormTextInput from '../../forms/FormTextInput'; @@ -45,23 +46,6 @@ type FullTimeOfferDetailsFormProps = Readonly<{ remove: UseFieldArrayRemove; }>; -function Section({ - children, - title, -}: Readonly<{ children: React.ReactNode; title: string }>) { - return ( -
-
-

- {title} -

- -
-
{children}
-
- ); -} - function FullTimeOfferDetailsForm({ index, remove, @@ -95,8 +79,8 @@ function FullTimeOfferDetailsForm({ return (
-
-
+ +
-
+
-
-
-
+ + +
-
-
+ +
)} - +
); } @@ -327,7 +311,7 @@ function InternshipOfferDetailsForm({ return (
-
+ -
+
-
+
-
-
-
+ + +
-
-
+ + -
+ {index > 0 && (
@@ -541,21 +525,19 @@ export default function OfferDetailsForm({ return (
-
+

Fill in your offer details -

-
- { - if (newJobType === jobType) { - return; - } + + { + if (newJobType === jobType) { + return; + } - setDialogOpen(true); - }} - /> -
+ setDialogOpen(true); + }} + />