@@ -5,10 +5,15 @@ import { DebouncedFunc } from 'lodash'; // Assuming you're using lodash's Deboun
55
66// import 'simplebar-react/dist/simplebar.min.css';
77
8- const ScrollBarWrapper = styled . div < { $hideplaceholder ?: boolean } > `
8+ const ScrollBarWrapper = styled . div < {
9+ $hideplaceholder ?: boolean ;
10+ $overflow ?: string ;
11+ } > `
912 min-height: 0;
10- height: 100%;
13+ height: ${ props => props . $overflow ? props . $overflow === 'scroll' ? '300px' : '100%' :'100%'
14+ } ;
1115 width: 100%;
16+ overflow:${ props => props . $overflow } ;
1217
1318 .simplebar-scrollbar::before {
1419 background: rgba(139, 143, 163, 0.5) !important;
@@ -37,7 +42,9 @@ const ScrollBarWrapper = styled.div<{ $hideplaceholder?: boolean }>`
3742 bottom: 10px;
3843 }
3944
40- ${ props => Boolean ( props . $hideplaceholder ) && `
45+ ${ ( props ) =>
46+ Boolean ( props . $hideplaceholder ) &&
47+ `
4148 .simplebar-placeholder {
4249 display: none !important;
4350 }
@@ -50,6 +57,7 @@ interface IProps {
5057 children : React . ReactNode ;
5158 className ?: string ;
5259 height ?: string ;
60+ overflow ?:string ,
5361 style ?: React . CSSProperties ; // Add this line to include a style prop
5462 scrollableNodeProps ?: {
5563 onScroll : DebouncedFunc < ( e : any ) => void > ;
@@ -62,6 +70,7 @@ export const ScrollBar = ({
6270 className,
6371 children,
6472 style,
73+ overflow,
6574 scrollableNodeProps,
6675 hideScrollbar = false ,
6776 $hideplaceholder = false ,
@@ -72,12 +81,16 @@ export const ScrollBar = ({
7281 const combinedStyle = { ...style , height } ; // Example of combining height with passed style
7382
7483 return hideScrollbar ? (
75- < ScrollBarWrapper className = { className } >
84+ < ScrollBarWrapper className = { className } $overflow = { overflow } >
7685 { children }
7786 </ ScrollBarWrapper >
7887 ) : (
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+ >
8194 { children }
8295 </ SimpleBar >
8396 </ ScrollBarWrapper >
0 commit comments