Add fade to /grid sidebar scroll

This commit is contained in:
Sam Becker 2025-02-05 18:13:39 -06:00
parent 70b7b609ee
commit 771f9a46cd
2 changed files with 36 additions and 18 deletions

View File

@ -27,10 +27,7 @@ export default function TooltipPrimitive({
useClickInsideOutside({
htmlElements: [refTrigger, refContent],
onClickOutside: () => {
console.log('onClickOutside');
setIsOpen(false);
},
onClickOutside: () => setIsOpen(false),
});
return (

View File

@ -17,7 +17,7 @@ export default function PhotoGridPage({
tags,
cameras,
simulations,
}:{
}: {
photos: Photo[]
photosCount: number
tags: Tags
@ -25,30 +25,51 @@ export default function PhotoGridPage({
simulations: FilmSimulations
}) {
const { setSelectedPhotoIds } = useAppState();
useEffect(
() => () => setSelectedPhotoIds?.(undefined),
[setSelectedPhotoIds],
);
const renderGuard = (side: 'top' | 'bottom') =>
<div
className={clsx(
'absolute left-0 right-0',
side === 'top'
? 'top-0 bg-gradient-to-b from-white dark:from-black'
: 'bottom-0 bg-gradient-to-t from-white dark:from-black',
'h-6 z-10 pointer-events-none',
)}
/>;
return (
<PhotoGridContainer
cacheKey={`page-${PATH_GRID_INFERRED}`}
photos={photos}
count={photosCount}
sidebar={
<div className={clsx(
'sticky top-0 -mt-5',
'max-h-screen overflow-y-auto py-4',
'[scrollbar-width:none]',
)}>
<PhotoGridSidebar {...{
tags,
cameras,
simulations,
photosCount,
}} />
</div>}
<div
className={clsx(
'sticky top-0 -mb-5 -mt-5',
'max-h-screen h-full',
)}
>
{renderGuard('top')}
<div className={clsx(
'max-h-full overflow-y-auto [scrollbar-width:none]',
'py-4',
)}>
<PhotoGridSidebar {...{
tags,
cameras,
simulations,
photosCount,
}}
/>
</div>
{renderGuard('bottom')}
</div>
}
canSelect
/>
);