From a735d2fa95144d514f751cc0970d4f03a09b0218 Mon Sep 17 00:00:00 2001 From: Innders <49156310+Innders@users.noreply.github.com> Date: Fri, 4 Oct 2024 14:22:31 +0100 Subject: [PATCH 1/3] fix(Sort): do not pass through all props --- src/Dropdowns/SortingDropdown/SortingDropdown.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Dropdowns/SortingDropdown/SortingDropdown.tsx b/src/Dropdowns/SortingDropdown/SortingDropdown.tsx index e554812..bd2f814 100644 --- a/src/Dropdowns/SortingDropdown/SortingDropdown.tsx +++ b/src/Dropdowns/SortingDropdown/SortingDropdown.tsx @@ -108,8 +108,10 @@ export const SortingDropdown: FC = ({ !isOpen && handleSortChange(id)} onRemove={() => !isOpen && handleRemove(id)} onKeyDown={(e) => { From d94852a332ae70f3c07752e375b4c365f53ca45f Mon Sep 17 00:00:00 2001 From: Innders <49156310+Innders@users.noreply.github.com> Date: Mon, 7 Oct 2024 17:51:33 +0100 Subject: [PATCH 2/3] fix(EntityCard): Status always on the right --- src/EntityCard/EntityCard.styled.ts | 21 +++++++++------------ src/EntityCard/EntityCard.tsx | 1 - 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/EntityCard/EntityCard.styled.ts b/src/EntityCard/EntityCard.styled.ts index 78524db..62b96d9 100644 --- a/src/EntityCard/EntityCard.styled.ts +++ b/src/EntityCard/EntityCard.styled.ts @@ -240,13 +240,6 @@ export const Card = styled.div` .status-container { padding-right: 0px; - - &.middle { - .status-wrapper { - justify-content: center; - padding-right: 0px; - } - } } &:hover { @@ -297,9 +290,17 @@ export const Card = styled.div` } } } + /* hide the priority */ + @container card (inline-size < 105px) { + .row-bottom { + .tag.priority { + visibility: hidden; + } + } + } /* hide everything on bottom but the status icon */ - @container card (inline-size < 85px) { + @container card (inline-size < 65px) { .row-bottom { .tag.users, .tag.priority { @@ -542,10 +543,6 @@ export const StatusContainer = styled.div` display: flex; justify-content: flex-end; padding-right: 2px; - &.middle { - padding-right: 0px; - justify-content: center; - } align-items: flex-end; /* the wrapper is the element that expands full width */ diff --git a/src/EntityCard/EntityCard.tsx b/src/EntityCard/EntityCard.tsx index 314e066..a893cba 100644 --- a/src/EntityCard/EntityCard.tsx +++ b/src/EntityCard/EntityCard.tsx @@ -347,7 +347,6 @@ export const EntityCard = forwardRef( {/* BOTTOM ROW */} Date: Tue, 8 Oct 2024 07:37:18 +0100 Subject: [PATCH 3/3] fix(EntityCard): breakpoint calculations --- src/EntityCard/EntityCard.tsx | 51 ++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/src/EntityCard/EntityCard.tsx b/src/EntityCard/EntityCard.tsx index a893cba..1801aa0 100644 --- a/src/EntityCard/EntityCard.tsx +++ b/src/EntityCard/EntityCard.tsx @@ -179,12 +179,17 @@ export const EntityCard = forwardRef( const [statusBreakpoints, setStatusBreakpoints] = useState<{ short?: number icon?: number + status?: string }>({}) useEffect(() => { if (!bottomRowRef.current || !status) return + // if widths for status are already calculated, don't recalculate + if (statusBreakpoints.status === status.name) return + const container = bottomRowRef.current + const containerWidth = container.offsetWidth // calculate how much space things other than status take up const containerPadding = 2 const usersWidth = @@ -193,6 +198,7 @@ export const EntityCard = forwardRef( (container.querySelector('.tag.priority') as HTMLElement)?.offsetWidth || (variant === 'status' ? 28 : 0) const takenWidth = usersWidth + priorityWidth + containerPadding * 2 + const remainingSpace = containerWidth - takenWidth // calculate the width of the status states const statusTextWidth = @@ -203,8 +209,9 @@ export const EntityCard = forwardRef( setStatusBreakpoints({ short: takenWidth + statusTextWidth, icon: takenWidth + statusShortWidth, + status: status?.name, }) - }, [bottomRowRef.current, status]) + }, [bottomRowRef.current, status?.name]) const handleTitleClick = (e: MouseEvent) => { if (!onTitleClick) return @@ -427,6 +434,27 @@ export const EntityCard = forwardRef( )} + {/* bottom left - priority */} + {shouldShowTag(priority && !hidePriority, 'priority') && ( + editOnHover && handleEditableHover(e, 'priority')} + onClick={(e) => handleEditableHover(e, 'priority')} + {...pt.priorityTag} + className={clsx( + 'tag priority', + { editable: priorityEditable, isLoading }, + pt.priorityTag?.className, + )} + > + {priority?.icon && ( + + )} + + )} + {/* bottom right - status */} {shouldShowTag(status, 'status') && ( ( )} - - {/* bottom left - priority */} - {shouldShowTag(priority && !hidePriority, 'priority') && ( - editOnHover && handleEditableHover(e, 'priority')} - onClick={(e) => handleEditableHover(e, 'priority')} - {...pt.priorityTag} - className={clsx( - 'tag priority', - { editable: priorityEditable, isLoading }, - pt.priorityTag?.className, - )} - > - {priority?.icon && ( - - )} - - )}