From 09c35f2518a238d03fb14bc43c68d1d6765bb401 Mon Sep 17 00:00:00 2001
From: Innders <49156310+Innders@users.noreply.github.com>
Date: Wed, 4 Sep 2024 11:53:41 +0100
Subject: [PATCH] fix(dropdown): remove icon for anything selected
---
.../AssigneeSelect/AssigneeDropdownTemplate.tsx | 13 ++-----------
src/Dropdowns/AssigneeSelect/AssigneeSelect.tsx | 5 +----
src/Dropdowns/Dropdown/Dropdown.tsx | 6 ++----
3 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/src/Dropdowns/AssigneeSelect/AssigneeDropdownTemplate.tsx b/src/Dropdowns/AssigneeSelect/AssigneeDropdownTemplate.tsx
index 4bcc658..fba658d 100644
--- a/src/Dropdowns/AssigneeSelect/AssigneeDropdownTemplate.tsx
+++ b/src/Dropdowns/AssigneeSelect/AssigneeDropdownTemplate.tsx
@@ -1,4 +1,4 @@
-import styled, { css } from 'styled-components'
+import styled from 'styled-components'
import { UserImage } from '../../User/UserImage'
import { Icon } from '../../Icon'
import clsx from 'clsx'
@@ -39,10 +39,7 @@ export interface AssigneeDropdownProps {
fullName?: string
avatarUrl?: string
isSelected?: boolean
- isMultiple: boolean
- mixedSelected: string[]
multiSelect: boolean
- multipleOverride: boolean
onClick?: () => void
size?: number
selectAll?: string | boolean
@@ -55,10 +52,7 @@ export const AssigneeDropdownTemplate = ({
avatarUrl,
fullName,
isSelected,
- isMultiple,
- mixedSelected,
multiSelect,
- multipleOverride,
onClick,
size = 21,
selectAll,
@@ -83,10 +77,7 @@ export const AssigneeDropdownTemplate = ({
{fullName || name}
{!!error && ' (missing)'}
- {multiSelect &&
- isMultiple &&
- !multipleOverride &&
- (mixedSelected?.includes(name) || isSelected) && }
+ {multiSelect && isSelected && }
)
}
diff --git a/src/Dropdowns/AssigneeSelect/AssigneeSelect.tsx b/src/Dropdowns/AssigneeSelect/AssigneeSelect.tsx
index a21a333..131361d 100644
--- a/src/Dropdowns/AssigneeSelect/AssigneeSelect.tsx
+++ b/src/Dropdowns/AssigneeSelect/AssigneeSelect.tsx
@@ -101,16 +101,13 @@ export const AssigneeSelect = forwardRef(
options={sortedOptions}
dataKey={'name'}
disabled={disabled}
- itemTemplate={(ops, isActive, isSelected, index, mixedSelected) => (
+ itemTemplate={(ops, isActive, isSelected) => (
)}
onChange={(added, removed) => onChange && onChange(added, removed)}
diff --git a/src/Dropdowns/Dropdown/Dropdown.tsx b/src/Dropdowns/Dropdown/Dropdown.tsx
index 4ef1036..d50ff02 100644
--- a/src/Dropdowns/Dropdown/Dropdown.tsx
+++ b/src/Dropdowns/Dropdown/Dropdown.tsx
@@ -965,10 +965,8 @@ export const Dropdown = forwardRef(
{option.icon && }
{option[labelKey] || option[dataKey]}
{multiSelect &&
- isMultiple &&
- !multipleOverride &&
- option[dataKey] !== selectAllKey &&
- !![...mixedSelected, ...selected]?.includes(option[dataKey]) && (
+ selected?.includes(option[dataKey]) &&
+ selected.length > minSelected && (
)}