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-theme bg-theme/5 ring-1 ring-theme " : "hover:bg-theme/5 " }` } > {value ? ( <> {value} ) : ( <> Due Date )} { if (!val) onChange(""); else onChange(renderDateFormat(val)); }} dateFormat="dd-MM-yyyy" inline /> )} );