1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

#35 added photoswipe handler

This commit is contained in:
Fedor Katurov 2021-03-06 15:08:05 +07:00
parent ce9dae941b
commit 5496db54f7
4 changed files with 25 additions and 9 deletions

View file

@ -11,22 +11,22 @@ interface IProps extends DetailsHTMLAttributes<HTMLDivElement> {}
const Sticky: FC<IProps> = ({ children }) => {
const ref = useRef(null);
let sb;
const sb = useRef<StickySidebar>(null);
useEffect(() => {
if (!ref.current) return;
sb = new StickySidebar(ref.current, {
sb.current = new StickySidebar(ref.current, {
resizeSensor: true,
topSpacing: 72,
bottomSpacing: 10,
});
return () => sb.destroy();
}, [ref.current, children]);
return () => sb.current?.destroy();
}, [ref.current, sb.current, children]);
if (sb) {
sb.updateSticky();
sb.current?.updateSticky();
}
return (