From 64bc8158c12d1d48b96bddb640caab38ca110f8c Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Tue, 1 Nov 2022 11:11:10 +0800 Subject: [PATCH] [offers][fix] tweak submit offer job type selector (#487) --- .../src/components/offers/JobTypeTabs.tsx | 50 +++++++++++++++++++ .../submissionForm/OfferDetailsForm.tsx | 43 +++++----------- apps/portal/src/pages/offers/index.tsx | 2 + packages/ui/src/Tabs/Tabs.tsx | 2 +- 4 files changed, 66 insertions(+), 31 deletions(-) create mode 100644 apps/portal/src/components/offers/JobTypeTabs.tsx diff --git a/apps/portal/src/components/offers/JobTypeTabs.tsx b/apps/portal/src/components/offers/JobTypeTabs.tsx new file mode 100644 index 00000000..8ea87bc6 --- /dev/null +++ b/apps/portal/src/components/offers/JobTypeTabs.tsx @@ -0,0 +1,50 @@ +import clsx from 'clsx'; +import { JobType } from '@prisma/client'; + +import { JobTypeLabel } from './types'; + +type Props = Readonly<{ + onChange: (jobType: JobType) => void; + value: JobType; +}>; + +const tabs = [ + { + label: JobTypeLabel.FULLTIME, + value: JobType.FULLTIME, + }, + { + label: JobTypeLabel.INTERN, + value: JobType.INTERN, + }, +]; + +export default function JobTypeTabs({ value, onChange }: Props) { + return ( +
+ +
+ ); +} diff --git a/apps/portal/src/components/offers/offersSubmission/submissionForm/OfferDetailsForm.tsx b/apps/portal/src/components/offers/offersSubmission/submissionForm/OfferDetailsForm.tsx index 63abe7d1..34a65829 100644 --- a/apps/portal/src/components/offers/offersSubmission/submissionForm/OfferDetailsForm.tsx +++ b/apps/portal/src/components/offers/offersSubmission/submissionForm/OfferDetailsForm.tsx @@ -32,6 +32,7 @@ import FormMonthYearPicker from '../../forms/FormMonthYearPicker'; import FormSelect from '../../forms/FormSelect'; import FormTextArea from '../../forms/FormTextArea'; import FormTextInput from '../../forms/FormTextInput'; +import JobTypeTabs from '../../JobTypeTabs'; import type { OfferFormData } from '../../types'; import { JobTypeLabel } from '../../types'; import { @@ -103,7 +104,7 @@ function FullTimeOfferDetailsForm({ })} /> -
+
Fill in your offer details -
-
-
-
-
+
+ { + if (newJobType === jobType) { + return; + } + + setDialogOpen(true); + }} + />
{ if (option) { setjobTitleFilter(option.value); @@ -56,6 +57,7 @@ export default function OffersHomePage() { { if (option) { setCompanyFilter(option.value); diff --git a/packages/ui/src/Tabs/Tabs.tsx b/packages/ui/src/Tabs/Tabs.tsx index ac34722e..d387424b 100644 --- a/packages/ui/src/Tabs/Tabs.tsx +++ b/packages/ui/src/Tabs/Tabs.tsx @@ -28,7 +28,7 @@ export default function Tabs({ label, tabs, value, onChange }: Props) { children: tab.label, className: clsx( isSelected - ? 'bg-indigo-100 text-indigo-700' + ? 'bg-primary-100 text-primary-700' : 'hover:bg-slate-100 text-slate-500 hover:text-slate-700', 'px-3 py-2 font-medium text-sm rounded-md', ),