From 1f1fa19432088b4501fff9fba6ccdba959f88ba6 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Thu, 2 Mar 2023 12:33:12 +0530 Subject: [PATCH] style: date dropdown redesign --- apps/app/components/issues/form.tsx | 7 +-- apps/app/components/issues/select/date.tsx | 70 ++++++++++++++++++++++ apps/app/components/issues/select/index.ts | 1 + 3 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 apps/app/components/issues/select/date.tsx diff --git a/apps/app/components/issues/form.tsx b/apps/app/components/issues/form.tsx index 44a2d39e5..d8dad77a2 100644 --- a/apps/app/components/issues/form.tsx +++ b/apps/app/components/issues/form.tsx @@ -14,6 +14,7 @@ import { IssuePrioritySelect, IssueProjectSelect, IssueStateSelect, + IssueDateSelect, } from "components/issues/select"; import { CreateStateModal } from "components/states"; import { CreateUpdateCycleModal } from "components/cycles"; @@ -294,11 +295,7 @@ export const IssueForm: FC = ({ control={control} name="target_date" render={({ field: { value, onChange } }) => ( - + )} /> diff --git a/apps/app/components/issues/select/date.tsx b/apps/app/components/issues/select/date.tsx new file mode 100644 index 000000000..da3ecb77a --- /dev/null +++ b/apps/app/components/issues/select/date.tsx @@ -0,0 +1,70 @@ +import React from "react"; + +import { Popover, Transition } from "@headlessui/react"; +import { CalendarDaysIcon, XMarkIcon } from "@heroicons/react/24/outline"; +// react-datepicker +import DatePicker from "react-datepicker"; +// import "react-datepicker/dist/react-datepicker.css"; +import { renderDateFormat } from "helpers/date-time.helper"; + +type Props = { + value: string | null; + onChange: (val: string | null) => void; +}; + +export const IssueDateSelect: React.FC = ({ value, onChange }) => ( + + {({ open }) => ( + <> + + `flex items-center text-xs cursor-pointer border rounded-md shadow-sm duration-200 + ${ + open + ? "outline-none border-[#3F76FF] bg-[rgba(63,118,255,0.05)] ring-1 ring-[#3F76FF] " + : "hover:bg-[rgba(63,118,255,0.05)] " + }` + } + > + + {value ? ( + <> + {value} + + + ) : ( + <> + + Due Date + + )} + + + + + + { + if (!val) onChange(""); + else onChange(renderDateFormat(val)); + }} + dateFormat="dd-MM-yyyy" + inline + /> + + + + )} + +); diff --git a/apps/app/components/issues/select/index.ts b/apps/app/components/issues/select/index.ts index 4338b3162..a21a1cbbb 100644 --- a/apps/app/components/issues/select/index.ts +++ b/apps/app/components/issues/select/index.ts @@ -4,3 +4,4 @@ export * from "./parent"; export * from "./priority"; export * from "./project"; export * from "./state"; +export * from "./date";