Fix sidebar scroll behavior

This commit is contained in:
Sam Becker 2025-05-06 12:20:10 -05:00
parent 5279250e8c
commit b635ba28cc
3 changed files with 13 additions and 3 deletions

View File

@ -5,6 +5,7 @@ export default function MaskedScroll({
direction,
fadeSize,
animationDuration,
setMaxSize,
hideScrollbar,
updateMaskOnEvents,
scrollToEndOnMount,
@ -20,6 +21,7 @@ Omit<Parameters<typeof useMaskedScroll>[0], 'ref'>) {
direction,
fadeSize,
animationDuration,
setMaxSize,
hideScrollbar,
updateMaskOnEvents,
scrollToEndOnMount,

View File

@ -14,6 +14,7 @@ export default function useMaskedScroll({
direction = 'vertical',
fadeSize = 24,
animationDuration = 0.3,
setMaxSize = true,
hideScrollbar = true,
// Disable when calling 'updateMask' explicitly
updateMaskOnEvents = true,
@ -24,6 +25,7 @@ export default function useMaskedScroll({
direction?: 'vertical' | 'horizontal'
fadeSize?: number
animationDuration?: number
setMaxSize?: boolean
hideScrollbar?: boolean
scrollToEndOnMount?: boolean
}) {
@ -106,10 +108,15 @@ export default function useMaskedScroll({
transition,
...hideScrollbar && { scrollbarWidth: 'none' },
...isVertical
? { maxHeight: '100%', overflowY: 'scroll' }
: { maxWidth: '100%', overflowX: 'scroll' },
? {
...setMaxSize && { maxHeight: '100%' },
overflowY: 'scroll',
} : {
...setMaxSize && { maxWidth: '100%' },
overflowX: 'scroll',
},
};
}, [isVertical, fadeSize, animationDuration, hideScrollbar]);
}, [isVertical, fadeSize, animationDuration, hideScrollbar, setMaxSize]);
return { styleMask, updateMask };
}

View File

@ -41,6 +41,7 @@ export default function PhotoGridPageClient({
'max-h-screen py-4',
)}
fadeSize={100}
setMaxSize={false}
>
<PhotoGridSidebar {...{
...categories,