Skip to content

Commit c6df86f

Browse files
author
Jakub Rożek
authored
feat(scroll-container): modify scrollbarWidth (#155)
* feat: modify scrollbarWidth * fix(scroll-list): drop default scrollbarWith to 8 * chore: de-dupe yarn.lock
1 parent 1c1f4b7 commit c6df86f

3 files changed

Lines changed: 164 additions & 2596 deletions

File tree

src/ScrollContainer/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface IScrollContainer extends Omit<ScrollbarProps, 'ref'> {
1919
}
2020

2121
const ScrollContainer = React.forwardRef<ScrollbarRefInstance, IScrollContainer>(
22-
({ id, children, shadows = true, autosize = true, ...props }, scrollbarRef) => {
22+
({ id, children, shadows = true, autosize = true, scrollbarWidth = 6, ...props }, scrollbarRef) => {
2323
const scrollbar = React.useRef<any>(null);
2424
const scrollbarCallback = React.useCallback<ScrollbarRef>(
2525
ref => {
@@ -103,7 +103,7 @@ const ScrollContainer = React.forwardRef<ScrollbarRefInstance, IScrollContainer>
103103
opacity: 0,
104104
cursor: 'pointer',
105105
background: 'inherit',
106-
width: 6,
106+
width: scrollbarWidth,
107107
marginRight: 0,
108108
borderRadius: 0,
109109
top: 0,
@@ -116,7 +116,7 @@ const ScrollContainer = React.forwardRef<ScrollbarRefInstance, IScrollContainer>
116116
opacity: 0,
117117
cursor: 'pointer',
118118
background: 'inherit',
119-
height: 6,
119+
height: scrollbarWidth,
120120
marginBottom: 0,
121121
borderRadius: 0,
122122
left: 0,

src/ScrollList/index.tsx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,24 @@ import { ScrollContainer } from '../ScrollContainer';
1212
* HELPERS
1313
*/
1414

15-
export const CustomScrollContainer = React.forwardRef<HTMLDivElement, IFixedSizeListProps & { listHeight: number }>(
16-
({ onScroll = noop, children, style, className }, ref) => {
17-
return (
18-
<div style={style} className="ScrollList-Scrollbars">
19-
<ScrollContainer
20-
ref={ref}
21-
// @ts-ignore typings on onScroll are not right?
22-
onScroll={scrollValues => onScroll({ currentTarget: scrollValues })}
23-
autosize={false}
24-
>
25-
<div className={cn('ScrollList-Content relative', className)}>{children}</div>
26-
</ScrollContainer>
27-
</div>
28-
);
29-
},
30-
);
15+
export const CustomScrollContainer = React.forwardRef<
16+
HTMLDivElement,
17+
IFixedSizeListProps & { listHeight: number; scrollbarWidth?: number }
18+
>(({ onScroll = noop, children, style, className, scrollbarWidth = 8 }, ref) => {
19+
return (
20+
<div style={style} className="ScrollList-Scrollbars">
21+
<ScrollContainer
22+
ref={ref}
23+
// @ts-ignore typings on onScroll are not right?
24+
onScroll={scrollValues => onScroll({ currentTarget: scrollValues })}
25+
autosize={false}
26+
scrollbarWidth={scrollbarWidth}
27+
>
28+
<div className={cn('ScrollList-Content relative', className)}>{children}</div>
29+
</ScrollContainer>
30+
</div>
31+
);
32+
});
3133

3234
/**
3335
* FIXED SIZE LIST

0 commit comments

Comments
 (0)