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.
This commit is contained in:
Lily Mara 2023-10-26 23:59:36 -07:00
parent 0afbb4fec1
commit 01856c3099

View file

@ -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}
/>
</Box>
)}
<LibraryListCardContent {...props} isHovered={isHovered} />
<LibraryListCardContent {...props} isHovered={isOpen} />
</VStack>
)
}