mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-16 21:15:33 -04:00
(cherry picked from commit e1cbc4a78249881de96160739a50c0a399ea4313) Closes #10378 Fixed: Links tooltip closing too quickly (cherry picked from commit 0b9a212f33381d07ff67e2453753aaab64cc8041) Closes #10400 Fixed: Movie links not opening on iOS (cherry picked from commit f20ac9dc348e1f5ded635f12ab925d982b1b8957) Closes #10425
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import React, { ForwardedRef, forwardRef, ReactNode, useCallback } from 'react';
|
|
import Scroller, { OnScroll } from 'Components/Scroller/Scroller';
|
|
import { isLocked } from 'Utilities/scrollLock';
|
|
import styles from './PageContentBody.css';
|
|
|
|
interface PageContentBodyProps {
|
|
className?: string;
|
|
innerClassName?: string;
|
|
children: ReactNode;
|
|
initialScrollTop?: number;
|
|
onScroll?: (payload: OnScroll) => void;
|
|
}
|
|
|
|
const PageContentBody = forwardRef(
|
|
(props: PageContentBodyProps, ref: ForwardedRef<HTMLDivElement>) => {
|
|
const {
|
|
className = styles.contentBody,
|
|
innerClassName = styles.innerContentBody,
|
|
children,
|
|
onScroll,
|
|
...otherProps
|
|
} = props;
|
|
|
|
const onScrollWrapper = useCallback(
|
|
(payload: OnScroll) => {
|
|
if (onScroll && !isLocked()) {
|
|
onScroll(payload);
|
|
}
|
|
},
|
|
[onScroll]
|
|
);
|
|
|
|
return (
|
|
<Scroller
|
|
ref={ref}
|
|
{...otherProps}
|
|
className={className}
|
|
scrollDirection="vertical"
|
|
onScroll={onScrollWrapper}
|
|
>
|
|
<div className={innerClassName}>{children}</div>
|
|
</Scroller>
|
|
);
|
|
}
|
|
);
|
|
|
|
export default PageContentBody;
|