Skip to content

Commit 294b24c

Browse files
committed
fix(AnalyticalTable): Prevent style warning when horizontal scrollbar is visible
1 parent 1375b64 commit 294b24c

File tree

1 file changed

+70
-41
lines changed

1 file changed

+70
-41
lines changed

packages/main/src/components/AnalyticalTable/scrollbars/VerticalScrollbar.tsx

Lines changed: 70 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,76 @@ interface VerticalScrollbarProps {
1212
handleVerticalScrollBarScroll: any;
1313
}
1414

15-
export const VerticalScrollbar = forwardRef((props: VerticalScrollbarProps, ref: Ref<HTMLDivElement>) => {
16-
const { internalRowHeight, tableRef, minRows, rows, handleVerticalScrollBarScroll } = props;
15+
export const VerticalScrollbar = forwardRef(
16+
(props: VerticalScrollbarProps, ref: Ref<HTMLDivElement>) => {
17+
const {
18+
internalRowHeight,
19+
tableRef,
20+
minRows,
21+
rows,
22+
handleVerticalScrollBarScroll,
23+
} = props;
1724

18-
const hasHorizontalScrollbar = tableRef?.current?.clientWidth !== tableRef?.current?.scrollWidth;
25+
const hasHorizontalScrollbar =
26+
tableRef?.current?.clientWidth !== tableRef?.current?.scrollWidth;
1927

20-
return (
21-
<FlexBox direction={FlexBoxDirection.Column} style={{ position: 'relative' }}>
22-
<div
23-
style={{
24-
height: `${internalRowHeight}px`,
25-
boxSizing: 'border-box',
26-
borderLeft: 'none',
27-
border: `1px solid ${ThemingParameters.sapList_BorderColor}`,
28-
backgroundColor: ThemingParameters.sapList_HeaderBackground
29-
}}
30-
/>
31-
<div
32-
ref={ref}
33-
style={{
34-
overflowY: 'auto',
35-
height: tableRef.current ? `${tableRef.current.clientHeight - internalRowHeight}px` : '0',
36-
border: `1px solid ${ThemingParameters.sapList_BorderColor}`,
37-
borderTop: 'none',
38-
borderLeft: 'none',
39-
boxSizing: 'border-box'
40-
}}
41-
onScroll={handleVerticalScrollBarScroll}
42-
className={GlobalStyleClasses.sapScrollBar}
28+
return (
29+
<FlexBox
30+
direction={FlexBoxDirection.Column}
31+
style={{ position: 'relative' }}
4332
>
44-
<div style={{ height: `${Math.max(minRows, rows.length) * internalRowHeight}px`, width: '1px' }} />
45-
</div>
46-
<div
47-
style={{
48-
flexGrow: 1,
49-
backgroundColor: ThemingParameters.sapList_HeaderBackground,
50-
border: hasHorizontalScrollbar ? `1px solid ${ThemingParameters.sapList_BorderColor}` : 'none',
51-
borderTop: 'none',
52-
borderLeft: 'none',
53-
boxSizing: 'border-box'
54-
}}
55-
/>
56-
</FlexBox>
57-
);
58-
});
33+
<div
34+
style={{
35+
height: `${internalRowHeight}px`,
36+
boxSizing: 'border-box',
37+
borderWidth: '1px',
38+
borderTopStyle: 'solid',
39+
borderBottomStyle: 'solid',
40+
borderRightStyle: 'solid',
41+
borderLeftStyle: 'none',
42+
borderColor: ThemingParameters.sapList_BorderColor,
43+
backgroundColor: ThemingParameters.sapList_HeaderBackground,
44+
}}
45+
/>
46+
<div
47+
ref={ref}
48+
style={{
49+
overflowY: 'auto',
50+
height: tableRef.current
51+
? `${tableRef.current.clientHeight - internalRowHeight}px`
52+
: '0',
53+
borderWidth: '1px',
54+
borderRightStyle: 'solid',
55+
borderBottomStyle: 'solid',
56+
borderTopStyle: 'none',
57+
borderLeftStyle: 'none',
58+
borderColor: ThemingParameters.sapList_BorderColor,
59+
boxSizing: 'border-box',
60+
}}
61+
onScroll={handleVerticalScrollBarScroll}
62+
className={GlobalStyleClasses.sapScrollBar}
63+
>
64+
<div
65+
style={{
66+
height: `${Math.max(minRows, rows.length) * internalRowHeight}px`,
67+
width: '1px',
68+
}}
69+
/>
70+
</div>
71+
<div
72+
style={{
73+
flexGrow: 1,
74+
backgroundColor: ThemingParameters.sapList_HeaderBackground,
75+
borderWidth: '1px',
76+
borderRightStyle: hasHorizontalScrollbar ? 'solid' : 'none',
77+
borderBottomStyle: hasHorizontalScrollbar ? 'solid' : 'none',
78+
borderTopStyle: 'none',
79+
borderLeftStyle: 'none',
80+
borderColor: ThemingParameters.sapList_BorderColor,
81+
boxSizing: 'border-box',
82+
}}
83+
/>
84+
</FlexBox>
85+
);
86+
}
87+
);

0 commit comments

Comments
 (0)