Optimize layout and stylesheet

This commit is contained in:
2024-01-18 17:29:42 +08:00
parent 9bcf559718
commit 343152c9d3
9 changed files with 37 additions and 58 deletions

View File

@@ -1,33 +1,18 @@
import { PropsWithChildren } from 'react'
import HideScrollbar, { HideScrollbarElement } from '@/components/common/HideScrollbar'
export interface SidebarScrollElement {
refreshLayout(): void
}
const Scroll = forwardRef<SidebarScrollElement, PropsWithChildren>((props, ref) => {
useImperativeHandle<SidebarScrollElement, SidebarScrollElement>(ref, () => {
return {
refreshLayout() {
hideScrollbarRef.current?.refreshLayout()
}
}
})
const hideScrollbarRef = useRef<HideScrollbarElement>(null)
import HideScrollbar from '@/components/common/HideScrollbar'
const Scroll = (props: PropsWithChildren) => {
return (
<div className={'scroll'}>
<HideScrollbar
isShowVerticalScrollbar={true}
scrollbarWidth={2}
autoHideWaitingTime={800}
ref={hideScrollbarRef}
>
{props.children}
</HideScrollbar>
</div>
)
})
}
export default Scroll