From c748b53f17df92467266a2ebfe6587d600b670a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 26 Jan 2019 10:51:16 +0100 Subject: [PATCH 1/2] Added missing props not being passed to scrollbar component, fixes #15058 --- .../CustomScrollbar/CustomScrollbar.tsx | 32 +++++++++++++------ .../src/components/Select/Select.tsx | 2 +- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx b/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx index eb50944ad35..12b5ff8062e 100644 --- a/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx +++ b/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx @@ -7,10 +7,10 @@ interface Props { autoHide?: boolean; autoHideTimeout?: number; autoHideDuration?: number; - autoMaxHeight?: string; + autoHeightMax?: string; hideTracksWhenNotNeeded?: boolean; scrollTop?: number; - setScrollTop: (value: React.MouseEvent) => void; + setScrollTop: (event: any) => void; autoHeightMin?: number | string; } @@ -20,13 +20,13 @@ interface Props { export class CustomScrollbar extends PureComponent { static defaultProps: Partial = { customClassName: 'custom-scrollbars', - autoHide: true, + autoHide: false, autoHideTimeout: 200, autoHideDuration: 200, - autoMaxHeight: '100%', - hideTracksWhenNotNeeded: false, setScrollTop: () => {}, - autoHeightMin: '0' + hideTracksWhenNotNeeded: false, + autoHeightMin: '0', + autoHeightMax: '100%', }; private ref: React.RefObject; @@ -45,7 +45,7 @@ export class CustomScrollbar extends PureComponent { } else { ref.scrollTop(this.props.scrollTop); } - } + } } componentDidMount() { @@ -57,16 +57,30 @@ export class CustomScrollbar extends PureComponent { } render() { - const { customClassName, children, autoMaxHeight } = this.props; + const { + customClassName, + children, + autoHeightMax, + autoHeightMin, + setScrollTop, + autoHide, + autoHideTimeout, + hideTracksWhenNotNeeded, + } = this.props; return (
} renderTrackVertical={props =>
} renderThumbHorizontal={props =>
} diff --git a/packages/grafana-ui/src/components/Select/Select.tsx b/packages/grafana-ui/src/components/Select/Select.tsx index 5246c7cbf15..6d83968d546 100644 --- a/packages/grafana-ui/src/components/Select/Select.tsx +++ b/packages/grafana-ui/src/components/Select/Select.tsx @@ -61,7 +61,7 @@ interface AsyncProps { export const MenuList = (props: any) => { return ( - {props.children} + {props.children} ); }; From 27858c027201ead10e55bd637224ce1527628ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 26 Jan 2019 11:04:50 +0100 Subject: [PATCH 2/2] Updated snapshot --- .../__snapshots__/CustomScrollbar.test.tsx.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/grafana-ui/src/components/CustomScrollbar/__snapshots__/CustomScrollbar.test.tsx.snap b/packages/grafana-ui/src/components/CustomScrollbar/__snapshots__/CustomScrollbar.test.tsx.snap index aabe3dd98c5..60b4a2e0aa5 100644 --- a/packages/grafana-ui/src/components/CustomScrollbar/__snapshots__/CustomScrollbar.test.tsx.snap +++ b/packages/grafana-ui/src/components/CustomScrollbar/__snapshots__/CustomScrollbar.test.tsx.snap @@ -7,7 +7,7 @@ exports[`CustomScrollbar renders correctly 1`] = ` Object { "height": "auto", "maxHeight": "100%", - "minHeight": 0, + "minHeight": "0", "overflow": "hidden", "position": "relative", "width": "100%", @@ -24,7 +24,7 @@ exports[`CustomScrollbar renders correctly 1`] = ` "marginBottom": 0, "marginRight": 0, "maxHeight": "calc(100% + 0px)", - "minHeight": 0, + "minHeight": "calc(0 + 0px)", "overflow": "scroll", "position": "relative", "right": undefined,