Refactor(HideScrollbar): Add scrollbar padding attributes
Add scrollbar padding attributes to allow custom scrollbar padding style
This commit is contained in:
@@ -68,7 +68,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.vertical-scrollbar {
|
.vertical-scrollbar {
|
||||||
padding: 12px 2px;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
left: 100%;
|
left: 100%;
|
||||||
top: 0;
|
top: 0;
|
||||||
@@ -80,7 +79,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.horizontal-scrollbar {
|
.horizontal-scrollbar {
|
||||||
padding: 4px 12px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 100%;
|
top: 100%;
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ interface HideScrollbarProps
|
|||||||
minHeight?: string | number
|
minHeight?: string | number
|
||||||
scrollbarWidth?: string | number
|
scrollbarWidth?: string | number
|
||||||
autoHideWaitingTime?: number
|
autoHideWaitingTime?: number
|
||||||
|
scrollbarAsidePadding?: number
|
||||||
|
scrollbarEdgePadding?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HideScrollbarElement {
|
export interface HideScrollbarElement {
|
||||||
@@ -74,6 +76,8 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
|
|||||||
children,
|
children,
|
||||||
style,
|
style,
|
||||||
className,
|
className,
|
||||||
|
scrollbarAsidePadding = 12,
|
||||||
|
scrollbarEdgePadding = 4,
|
||||||
...props
|
...props
|
||||||
},
|
},
|
||||||
ref
|
ref
|
||||||
@@ -578,7 +582,8 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
|
|||||||
? maskRef.current?.clientLeft +
|
? maskRef.current?.clientLeft +
|
||||||
maskRef.current?.clientWidth -
|
maskRef.current?.clientWidth -
|
||||||
1
|
1
|
||||||
: undefined
|
: undefined,
|
||||||
|
padding: `${scrollbarAsidePadding}px ${scrollbarEdgePadding}px`
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={'box'} style={{ width: scrollbarWidth }}>
|
<div className={'box'} style={{ width: scrollbarWidth }}>
|
||||||
@@ -620,7 +625,8 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
|
|||||||
? maskRef.current?.clientTop +
|
? maskRef.current?.clientTop +
|
||||||
maskRef.current?.clientHeight -
|
maskRef.current?.clientHeight -
|
||||||
1
|
1
|
||||||
: undefined
|
: undefined,
|
||||||
|
padding: `${scrollbarAsidePadding}px ${scrollbarEdgePadding}px`
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={'box'} style={{ height: scrollbarWidth }}>
|
<div className={'box'} style={{ height: scrollbarWidth }}>
|
||||||
|
|||||||
Reference in New Issue
Block a user