From 5ae1f639851d4c1db7d669f97dbce938a4e47e74 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Thu, 2 Mar 2023 13:29:55 +0530 Subject: [PATCH] fix: dropdown issue label --- apps/app/components/issues/select/label.tsx | 12 ++++---- apps/app/components/ui/avatar.tsx | 2 +- apps/app/components/ui/index.ts | 1 + apps/app/components/ui/label-list.tsx | 32 +++++++++++++++++++++ 4 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 apps/app/components/ui/label-list.tsx diff --git a/apps/app/components/issues/select/label.tsx b/apps/app/components/issues/select/label.tsx index 74bc87eb5..bed23fce5 100644 --- a/apps/app/components/issues/select/label.tsx +++ b/apps/app/components/issues/select/label.tsx @@ -20,6 +20,7 @@ import issuesServices from "services/issues.service"; import type { IIssueLabels } from "types"; // fetch-keys import { PROJECT_ISSUE_LABELS } from "constants/fetch-keys"; +import { IssueLabelList } from "components/ui"; type Props = { setIsOpen: React.Dispatch>; @@ -70,12 +71,11 @@ export const IssueLabelSelect: React.FC = ({ setIsOpen, value, onChange, > {value && value.length > 0 ? ( - - {Array.isArray(value) - ? value.map((v) => issueLabels?.find((l) => l.id === v)?.name).join(", ") || - "Labels" - : issueLabels?.find((l) => l.id === value)?.name || "Labels"} - + issueLabels?.find((l) => l.id === v)?.color) ?? []} + length={3} + showLength + /> {value.length} Labels ) : ( diff --git a/apps/app/components/ui/avatar.tsx b/apps/app/components/ui/avatar.tsx index e4dc68839..2b1c7b2cc 100644 --- a/apps/app/components/ui/avatar.tsx +++ b/apps/app/components/ui/avatar.tsx @@ -18,7 +18,7 @@ type AvatarProps = { }; export const Avatar: React.FC = ({ user, index }) => ( -
+
{user && user.avatar && user.avatar !== "" ? (
= ({ + labels, + length = 5, + showLength = true, +}) => ( + <> + {labels && ( + <> + {labels.map((color, index) => ( +
+ +
+ ))} + {labels.length > length ? +{labels.length - length} : null} + + )} + +);