Add scroll controller
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
import React, { PropsWithChildren } from 'react'
|
||||
import React from 'react'
|
||||
import '@/assets/css/hide-scrollbar.scss'
|
||||
|
||||
const HideScrollbar: React.FC<PropsWithChildren> = (prop: PropsWithChildren) => {
|
||||
interface HideScrollbarProps extends PropsWithChildren {
|
||||
getHideScrollbarRef: (hideScrollbarRef: RefObject<HTMLElement>) => void
|
||||
}
|
||||
|
||||
const HideScrollbar: React.FC<HideScrollbarProps> = (props) => {
|
||||
const hideScrollbarRef = useRef<HTMLDivElement>(null)
|
||||
const [verticalScrollbarWidth, setVerticalScrollbarWidth] = useState(0)
|
||||
const [horizontalScrollbarWidth, setHorizontalScrollbarWidth] = useState(0)
|
||||
|
||||
props.getHideScrollbarRef(hideScrollbarRef)
|
||||
|
||||
useEffect(() => {
|
||||
const hideScrollbarElement = hideScrollbarRef.current
|
||||
|
||||
@@ -42,7 +48,7 @@ const HideScrollbar: React.FC<PropsWithChildren> = (prop: PropsWithChildren) =>
|
||||
height: `calc(100vh + ${horizontalScrollbarWidth}px`
|
||||
}}
|
||||
>
|
||||
{prop.children}
|
||||
{props.children}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user