From b60237b6760d9155a011e788285705342b9aab43 Mon Sep 17 00:00:00 2001 From: Ankush Deshmukh Date: Tue, 14 Nov 2023 20:52:43 +0530 Subject: [PATCH] Standarding priority icons across the platform (#2776) --- packages/ui/src/icons/priority-icon.tsx | 38 +++++++++++---- packages/ui/src/icons/type.d.ts | 1 + web/components/inbox/issue-card.tsx | 14 ------ .../filters/header/filters/priority.tsx | 48 ++----------------- .../issue-layouts/kanban/headers/priority.tsx | 33 ++----------- .../issues/sidebar-select/priority.tsx | 8 ++-- web/components/project/priority-select.tsx | 18 ++----- 7 files changed, 46 insertions(+), 114 deletions(-) diff --git a/packages/ui/src/icons/priority-icon.tsx b/packages/ui/src/icons/priority-icon.tsx index 2c2e012e9..7d7f02694 100644 --- a/packages/ui/src/icons/priority-icon.tsx +++ b/packages/ui/src/icons/priority-icon.tsx @@ -15,24 +15,42 @@ import { IPriorityIcon } from "./type"; export const PriorityIcon: React.FC = ({ priority, className = "", + transparentBg = false }) => { - if (!className || className === "") className = "h-3.5 w-3.5"; + if (!className || className === "") className = "h-4 w-4"; // Convert to lowercase for string comparison const lowercasePriority = priority?.toLowerCase(); + //get priority icon + const getPriorityIcon = (): React.ReactNode => { + switch (lowercasePriority) { + case 'urgent': + return ; + case 'high': + return ; + case 'medium': + return ; + case 'low': + return ; + default: + return ; + } + }; + return ( <> - {lowercasePriority === "urgent" ? ( - - ) : lowercasePriority === "high" ? ( - - ) : lowercasePriority === "medium" ? ( - - ) : lowercasePriority === "low" ? ( - + { transparentBg ? ( + getPriorityIcon() ) : ( - +
+ { getPriorityIcon() } +
)} ); diff --git a/packages/ui/src/icons/type.d.ts b/packages/ui/src/icons/type.d.ts index 0261ab163..65b188e4c 100644 --- a/packages/ui/src/icons/type.d.ts +++ b/packages/ui/src/icons/type.d.ts @@ -7,4 +7,5 @@ export type TIssuePriorities = "urgent" | "high" | "medium" | "low" | "none"; export interface IPriorityIcon { priority: TIssuePriorities | null; className?: string; + transparentBg?: boolean | false; } diff --git a/web/components/inbox/issue-card.tsx b/web/components/inbox/issue-card.tsx index 56f6b6dcc..47080e367 100644 --- a/web/components/inbox/issue-card.tsx +++ b/web/components/inbox/issue-card.tsx @@ -42,21 +42,7 @@ export const InboxIssueCard: React.FC = (props) => {
-
-
{ - if (priority === "urgent") - return ( -
- -
- ); - if (priority === "high") - return ( -
- -
- ); - if (priority === "medium") - return ( -
- -
- ); - if (priority === "low") - return ( -
- -
- ); - return ( -
- -
- ); -}; - type Props = { appliedFilters: string[] | null; handleUpdate: (val: string) => void; @@ -78,7 +40,7 @@ export const FilterPriority: React.FC = observer((props) => { key={priority.key} isChecked={appliedFilters?.includes(priority.key) ? true : false} onClick={() => handleUpdate(priority.key)} - icon={} + icon={} title={priority.title} /> )) diff --git a/web/components/issues/issue-layouts/kanban/headers/priority.tsx b/web/components/issues/issue-layouts/kanban/headers/priority.tsx index 57fe6cd07..fea41dbeb 100644 --- a/web/components/issues/issue-layouts/kanban/headers/priority.tsx +++ b/web/components/issues/issue-layouts/kanban/headers/priority.tsx @@ -5,6 +5,9 @@ import { AlertCircle, SignalHigh, SignalMedium, SignalLow, Ban } from "lucide-re import { HeaderGroupByCard } from "./group-by-card"; import { HeaderSubGroupByCard } from "./sub-group-by-card"; +// Icons +import { PriorityIcon } from "@plane/ui"; + export interface IPriorityHeader { column_id: string; column_value: any; @@ -16,32 +19,6 @@ export interface IPriorityHeader { handleKanBanToggle: any; } -const Icon = ({ priority }: any) => ( -
- {priority === "urgent" ? ( -
- -
- ) : priority === "high" ? ( -
- -
- ) : priority === "medium" ? ( -
- -
- ) : priority === "low" ? ( -
- -
- ) : ( -
- -
- )} -
-); - export const PriorityHeader: FC = observer((props) => { const { column_id, @@ -62,7 +39,7 @@ export const PriorityHeader: FC = observer((props) => { (sub_group_by && header_type === "sub_group_by" ? ( } + icon={} title={priority?.title || ""} count={issues_count} kanBanToggle={kanBanToggle} @@ -73,7 +50,7 @@ export const PriorityHeader: FC = observer((props) => { sub_group_by={sub_group_by} group_by={group_by} column_id={column_id} - icon={} + icon={} title={priority?.title || ""} count={issues_count} kanBanToggle={kanBanToggle} diff --git a/web/components/issues/sidebar-select/priority.tsx b/web/components/issues/sidebar-select/priority.tsx index 3d36acabc..e6f142e6e 100644 --- a/web/components/issues/sidebar-select/priority.tsx +++ b/web/components/issues/sidebar-select/priority.tsx @@ -17,7 +17,7 @@ export const SidebarPrioritySelect: React.FC = ({ value, onChange, disabl = ({ value, onChange, disabl : "bg-custom-background-80 border-custom-border-200 text-custom-text-200" }`} > - - + + {value ?? "None"}
@@ -43,7 +43,7 @@ export const SidebarPrioritySelect: React.FC = ({ value, onChange, disabl {PRIORITIES.map((option) => ( <> - + {option ?? "None"} diff --git a/web/components/project/priority-select.tsx b/web/components/project/priority-select.tsx index 9c12e6433..b2bf4413b 100644 --- a/web/components/project/priority-select.tsx +++ b/web/components/project/priority-select.tsx @@ -32,7 +32,7 @@ export const PrioritySelect: React.FC = ({ optionsClassName = "", placement, showTitle = false, - highlightUrgentPriority = true, + //highlightUrgentPriority = true, hideDropdownArrow = false, disabled = false, }) => { @@ -74,7 +74,7 @@ export const PrioritySelect: React.FC = ({
{showTitle && {value}}
@@ -93,19 +93,7 @@ export const PrioritySelect: React.FC = ({