From d8e1710a9b7d6e88f8e4b0612bf468babbb791b3 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Thu, 2 Mar 2023 09:01:47 +0530 Subject: [PATCH] style: state dropdown redesign --- apps/app/components/issues/select/state.tsx | 116 +++++++++++++------- 1 file changed, 76 insertions(+), 40 deletions(-) diff --git a/apps/app/components/issues/select/state.tsx b/apps/app/components/issues/select/state.tsx index 269b0af73..51e49a470 100644 --- a/apps/app/components/issues/select/state.tsx +++ b/apps/app/components/issues/select/state.tsx @@ -7,7 +7,12 @@ import useSWR from "swr"; // services import stateService from "services/state.service"; // headless ui -import { Squares2X2Icon, PlusIcon } from "@heroicons/react/24/outline"; +import { + Squares2X2Icon, + PlusIcon, + MagnifyingGlassIcon, + CheckIcon, +} from "@heroicons/react/24/outline"; // icons import { Combobox, Transition } from "@headlessui/react"; // helpers @@ -47,7 +52,6 @@ export const IssueStateSelect: React.FC = ({ setIsOpen, value, onChange, query === "" ? options : options?.filter((option) => option.display.toLowerCase().includes(query.toLowerCase())); - return ( = ({ setIsOpen, value, onChange, > {({ open }: any) => ( <> - State + `flex items-center text-xs cursor-pointer border rounded-md shadow-sm duration-300 + ${ + open + ? "outline-none border-[#3F76FF] bg-[rgba(63,118,255,0.05)] ring-1 ring-[#3F76FF] " + : "hover:bg-[rgba(63,118,255,0.05)] focus:bg-[rgba(63,118,255,0.05)]" + }` + } > - - + {value && value !== "" ? ( - option.value === value)?.color, - }} - /> - ) : null} - {options?.find((option) => option.value === value)?.display || "State"} + + option.value === value)?.color, + }} + /> + + {options?.find((option) => option.value === value)?.display} + + + ) : ( + + + + {options?.find((option) => option.value === value)?.display || "State"} + + + )} @@ -83,38 +103,52 @@ export const IssueStateSelect: React.FC = ({ setIsOpen, value, onChange, leaveTo="opacity-0" > - setQuery(event.target.value)} - placeholder="Search" - displayValue={(assigned: any) => assigned?.name} - /> -
+
+ + setQuery(event.target.value)} + placeholder="Search" + displayValue={(assigned: any) => assigned?.name} + /> +
+
{filteredOptions ? ( filteredOptions.length > 0 ? ( filteredOptions.map((option) => ( - `${active ? "bg-indigo-50" : ""} ${ - selected ? "bg-indigo-50 font-medium" : "" - } flex cursor-pointer select-none items-center gap-2 truncate p-2 text-gray-900` + className={({ active }) => + `${ + active ? "bg-[#E9ECEF]" : "" + } group flex min-w-[14rem] cursor-pointer select-none items-center gap-2 truncate rounded px-1 py-1.5 text-[#495057]` } value={option.value} > - {states && ( - <> - - {option.display} - - )} + {({ selected, active }) => + states && ( +
+
+ + {option.display} +
+
+ +
+
+ ) + }
)) ) : ( @@ -125,11 +159,13 @@ export const IssueStateSelect: React.FC = ({ setIsOpen, value, onChange, )}