From bc076e69f792dd85f4798f773c6a2ebc17bdea74 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Tue, 25 Jul 2023 12:07:16 +0530 Subject: [PATCH] style: issue label ui updated (#1653) * style: issue label ui updated * chore: code refactor --- .../core/board-view/single-issue.tsx | 10 +--- .../core/list-view/single-issue.tsx | 14 +---- .../core/spreadsheet-view/single-issue.tsx | 12 +--- apps/app/components/issues/index.ts | 1 + apps/app/components/issues/label.tsx | 55 +++++++++++++++++++ 5 files changed, 63 insertions(+), 29 deletions(-) create mode 100644 apps/app/components/issues/label.tsx diff --git a/apps/app/components/core/board-view/single-issue.tsx b/apps/app/components/core/board-view/single-issue.tsx index bd87dde6c..bab90c537 100644 --- a/apps/app/components/core/board-view/single-issue.tsx +++ b/apps/app/components/core/board-view/single-issue.tsx @@ -23,7 +23,7 @@ import { ViewAssigneeSelect, ViewDueDateSelect, ViewEstimateSelect, - ViewLabelSelect, + ViewIssueLabel, ViewPrioritySelect, ViewStateSelect, } from "components/issues"; @@ -365,13 +365,7 @@ export const SingleBoardIssue: React.FC = ({ /> )} {properties.labels && issue.labels.length > 0 && ( - + )} {properties.assignee && ( = ({ isNotAllowed={isNotAllowed} /> )} - {properties.labels && issue.labels.length > 0 && ( - - )} + {properties.labels && } {properties.assignee && ( = ({ )} {properties.labels && (
- +
)} diff --git a/apps/app/components/issues/index.ts b/apps/app/components/issues/index.ts index 0ac13c992..7e9bff175 100644 --- a/apps/app/components/issues/index.ts +++ b/apps/app/components/issues/index.ts @@ -13,3 +13,4 @@ export * from "./my-issues-list-item"; export * from "./parent-issues-list-modal"; export * from "./sidebar"; export * from "./sub-issues-list"; +export * from "./label"; diff --git a/apps/app/components/issues/label.tsx b/apps/app/components/issues/label.tsx new file mode 100644 index 000000000..f3a7be9dd --- /dev/null +++ b/apps/app/components/issues/label.tsx @@ -0,0 +1,55 @@ +import React from "react"; + +// components +import { Tooltip } from "components/ui"; +// types +import { IIssue } from "types"; + +type Props = { + issue: IIssue; + maxRender?: number; +}; + +export const ViewIssueLabel: React.FC = ({ issue, maxRender = 1 }) => ( + <> + {issue.label_details.length > 0 ? ( + issue.label_details.length <= maxRender ? ( + <> + {issue.label_details.map((label, index) => ( +
+ +
+ + {label.name} +
+
+
+ ))} + + ) : ( +
+ l.name).join(", ")} + > +
+ + {`${issue.label_details.length} Labels`} +
+
+
+ ) + ) : ( + "" + )} + +);