From 01856c309971ce977d93c8d69a2b2d3b31c249c0 Mon Sep 17 00:00:00 2001 From: Lily Mara Date: Thu, 26 Oct 2023 23:59:36 -0700 Subject: [PATCH] Fix hover behavior of library list hover actions In the library list view, there is a toolbar of actions that appears over each entry when you hover over it. This change fixes the hover behavior of this toolbar so that you do not need to move the mouse cursor out and back into the library list item after archiving/deleting a previous item in order to re-activate the toolbar. --- .../patterns/LibraryCards/LibraryListCard.tsx | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/web/components/patterns/LibraryCards/LibraryListCard.tsx b/packages/web/components/patterns/LibraryCards/LibraryListCard.tsx index 666a0b04c..a3ffda950 100644 --- a/packages/web/components/patterns/LibraryCards/LibraryListCard.tsx +++ b/packages/web/components/patterns/LibraryCards/LibraryListCard.tsx @@ -36,8 +36,6 @@ import { LoadingBar } from '../../elements/LoadingBar' export function LibraryListCard(props: LinkedItemCardProps): JSX.Element { const router = useRouter() - const [isHovered, setIsHovered] = useState(false) - const [isOpen, setIsOpen] = useState(false) const { refs, floatingStyles, context } = useFloating({ @@ -93,12 +91,6 @@ export function LibraryListCard(props: LinkedItemCardProps): JSX.Element { }} alignment="start" distribution="start" - onMouseEnter={() => { - setIsHovered(true) - }} - onMouseLeave={() => { - setIsHovered(false) - }} onClick={(event) => { if (event.metaKey || event.ctrlKey) { window.open( @@ -120,11 +112,11 @@ export function LibraryListCard(props: LinkedItemCardProps): JSX.Element { item={props.item} viewer={props.viewer} handleAction={props.handleAction} - isHovered={isHovered ?? false} + isHovered={isOpen ?? false} /> )} - + ) }