From 217d6ea51ca01694410c3f850e431852451d2eba Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Thu, 2 Mar 2023 08:03:41 +0530 Subject: [PATCH] style: assignee dropdown --- .../app/components/issues/select/assignee.tsx | 83 ++++++++++++------- apps/app/components/ui/avatar.tsx | 17 ++-- 2 files changed, 63 insertions(+), 37 deletions(-) diff --git a/apps/app/components/issues/select/assignee.tsx b/apps/app/components/issues/select/assignee.tsx index de77ca52b..291d64c6b 100644 --- a/apps/app/components/issues/select/assignee.tsx +++ b/apps/app/components/issues/select/assignee.tsx @@ -11,7 +11,7 @@ import projectServices from "services/project.service"; // ui import { AssigneesList, Avatar } from "components/ui"; // icons -import { UserGroupIcon } from "@heroicons/react/24/outline"; +import { UserGroupIcon, MagnifyingGlassIcon, CheckIcon } from "@heroicons/react/24/outline"; // fetch keys import { PROJECT_MEMBERS } from "constants/fetch-keys"; @@ -64,18 +64,27 @@ export const IssueAssigneeSelect: FC = ({ > {({ open }: any) => ( <> - - + + `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.length > 0 && Array.isArray(value) ? ( - <> - - Assignees - + + + {value.length} Assignees + ) : ( - <> - - Assignee - + + + Assignee + )} @@ -88,34 +97,50 @@ export const IssueAssigneeSelect: FC = ({ leaveTo="opacity-0" > - setQuery(event.target.value)} - placeholder="Search" - displayValue={(assigned: any) => assigned?.name} - /> -
+
+ + setQuery(event.target.value)} + placeholder="Search for a person..." + 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 px-2 py-1 text-gray-900` + `${ + active ? "bg-[#E9ECEF]" : "" + } group flex cursor-pointer select-none items-center gap-2 truncate rounded px-1 py-1.5 text-gray-900` } value={option.value} > - {people && ( - <> - p.member.id === option.value)?.member} - /> - {option.display} - + {({ selected, active }) => ( +
+
+ p.member.id === option.value)?.member} + /> + {option.display} +
+
+ +
+
)}
)) diff --git a/apps/app/components/ui/avatar.tsx b/apps/app/components/ui/avatar.tsx index 25e2dec7d..e4dc68839 100644 --- a/apps/app/components/ui/avatar.tsx +++ b/apps/app/components/ui/avatar.tsx @@ -47,14 +47,14 @@ type AsigneesListProps = { users?: Partial | (Partial | undefined)[] | Partial[]; userIds?: string[]; length?: number; - showTotalLength?: boolean; + showLength?: boolean; }; export const AssigneesList: React.FC = ({ users, userIds, length = 5, - showTotalLength = false, + showLength = true, }) => { const router = useRouter(); const { workspaceSlug } = router.query; @@ -88,12 +88,13 @@ export const AssigneesList: React.FC = ({ return ; })} - - {showTotalLength ? ( - {userIds.length} - ) : userIds.length > length ? ( - +{userIds.length - length} - ) : null} + {showLength ? ( + userIds.length > length ? ( + +{userIds.length - length} + ) : null + ) : ( + "" + )} )}