mirror of
https://github.com/Afilmory/afilmory
synced 2026-02-01 22:48:17 +00:00
feat: enhance GalleryThumbnail with virtualized rendering and hover card support
- Integrated virtualized rendering using @tanstack/react-virtual for improved performance in the GalleryThumbnail component. - Added HoverCard functionality for displaying additional photo information on hover. - Removed unused thumbnail gap and padding size constants to streamline the code. - Updated scroll behavior to utilize virtual item measurements for accurate thumbnail positioning. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -3,6 +3,8 @@ import * as HoverCardPrimitive from '@radix-ui/react-hover-card'
|
||||
import { m } from 'motion/react'
|
||||
import * as React from 'react'
|
||||
|
||||
import { RootPortal } from '../portal'
|
||||
|
||||
const HoverCard = HoverCardPrimitive.Root
|
||||
|
||||
const HoverCardTrigger = HoverCardPrimitive.Trigger
|
||||
@@ -16,7 +18,7 @@ const HoverCardContent = ({
|
||||
}: React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content> & {
|
||||
ref?: React.RefObject<React.ElementRef<typeof HoverCardPrimitive.Content> | null>
|
||||
}) => (
|
||||
<HoverCardPrimitive.Portal>
|
||||
<RootPortal>
|
||||
<HoverCardPrimitive.Content
|
||||
ref={ref}
|
||||
align={align}
|
||||
@@ -59,7 +61,7 @@ const HoverCardContent = ({
|
||||
<div className="relative">{props.children}</div>
|
||||
</m.div>
|
||||
</HoverCardPrimitive.Content>
|
||||
</HoverCardPrimitive.Portal>
|
||||
</RootPortal>
|
||||
)
|
||||
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName
|
||||
|
||||
|
||||
Reference in New Issue
Block a user