Optimize file name
This commit is contained in:
33
src/components/common/Sidebar/Scroll.tsx
Normal file
33
src/components/common/Sidebar/Scroll.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import React from 'react'
|
||||
import HideScrollbar, { HideScrollbarElement } from '@/components/common/HideScrollbar'
|
||||
|
||||
export interface SidebarScrollElement {
|
||||
refreshLayout(): void
|
||||
}
|
||||
|
||||
const Scroll = forwardRef<SidebarScrollElement, React.PropsWithChildren>((props, ref) => {
|
||||
useImperativeHandle<SidebarScrollElement, SidebarScrollElement>(ref, () => {
|
||||
return {
|
||||
refreshLayout() {
|
||||
hideScrollbarRef.current?.refreshLayout()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const hideScrollbarRef = useRef<HideScrollbarElement>(null)
|
||||
|
||||
return (
|
||||
<div className={'scroll'}>
|
||||
<HideScrollbar
|
||||
isShowVerticalScrollbar={true}
|
||||
scrollbarWidth={2}
|
||||
autoHideWaitingTime={800}
|
||||
ref={hideScrollbarRef}
|
||||
>
|
||||
{props.children}
|
||||
</HideScrollbar>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
||||
export default Scroll
|
||||
Reference in New Issue
Block a user