@@ -5,10 +5,15 @@ import { DebouncedFunc } from 'lodash'; // Assuming you're using lodash's Deboun
5
5
6
6
// import 'simplebar-react/dist/simplebar.min.css';
7
7
8
- const ScrollBarWrapper = styled . div < { $hideplaceholder ?: boolean } > `
8
+ const ScrollBarWrapper = styled . div < {
9
+ $hideplaceholder ?: boolean ;
10
+ $overflow ?: string ;
11
+ } > `
9
12
min-height: 0;
10
- height: 100%;
13
+ height: ${ props => props . $overflow ? props . $overflow === 'scroll' ? '300px' : '100%' :'100%'
14
+ } ;
11
15
width: 100%;
16
+ overflow:${ props => props . $overflow } ;
12
17
13
18
.simplebar-scrollbar::before {
14
19
background: rgba(139, 143, 163, 0.5) !important;
@@ -37,7 +42,9 @@ const ScrollBarWrapper = styled.div<{ $hideplaceholder?: boolean }>`
37
42
bottom: 10px;
38
43
}
39
44
40
- ${ props => Boolean ( props . $hideplaceholder ) && `
45
+ ${ ( props ) =>
46
+ Boolean ( props . $hideplaceholder ) &&
47
+ `
41
48
.simplebar-placeholder {
42
49
display: none !important;
43
50
}
@@ -50,6 +57,7 @@ interface IProps {
50
57
children : React . ReactNode ;
51
58
className ?: string ;
52
59
height ?: string ;
60
+ overflow ?:string ,
53
61
style ?: React . CSSProperties ; // Add this line to include a style prop
54
62
scrollableNodeProps ?: {
55
63
onScroll : DebouncedFunc < ( e : any ) => void > ;
@@ -62,6 +70,7 @@ export const ScrollBar = ({
62
70
className,
63
71
children,
64
72
style,
73
+ overflow,
65
74
scrollableNodeProps,
66
75
hideScrollbar = false ,
67
76
$hideplaceholder = false ,
@@ -72,12 +81,16 @@ export const ScrollBar = ({
72
81
const combinedStyle = { ...style , height } ; // Example of combining height with passed style
73
82
74
83
return hideScrollbar ? (
75
- < ScrollBarWrapper className = { className } >
84
+ < ScrollBarWrapper className = { className } $overflow = { overflow } >
76
85
{ children }
77
86
</ ScrollBarWrapper >
78
87
) : (
79
- < ScrollBarWrapper className = { className } >
80
- < SimpleBar style = { combinedStyle } scrollableNodeProps = { scrollableNodeProps } { ...otherProps } >
88
+ < ScrollBarWrapper className = { className } $overflow = { overflow } >
89
+ < SimpleBar
90
+ style = { combinedStyle }
91
+ scrollableNodeProps = { scrollableNodeProps }
92
+ { ...otherProps }
93
+ >
81
94
{ children }
82
95
</ SimpleBar >
83
96
</ ScrollBarWrapper >
0 commit comments