diff --git a/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx b/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx index 683dcc631ff..0dc4c3ad814 100644 --- a/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx +++ b/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx @@ -17,7 +17,16 @@ interface Props { setScrollTop: (event: any) => void; autoHeightMin?: number | string; updateAfterMountMs?: number; - page?: boolean; + scrollbarStickLeft?: boolean; +} + +interface StylesInterface { + customScrollbar: string; + trackVertical: string; + trackHorizontal: string; + thumbVertical: string; + thumbHorizontal: string; + view: string; } /** @@ -72,35 +81,31 @@ export class CustomScrollbar extends Component { this.updateScroll(); } - renderTrack = (styles: any, hideTrack: boolean | undefined, passedProps: any) => { + renderTrack = (style: string, hideTrack: boolean | undefined, passedProps: any) => { if (passedProps.style && hideTrack) { passedProps.style.display = 'none'; } - return
; + return
; }; - // renderThumb = (thumb: styles.thumbVertical | styles.thumbHorizontal, passedProps: any) => { - // return
; - // }; - - renderTrackHorizontal = (passedProps: any, styles: any) => { + renderTrackHorizontal = (passedProps: any, styles: StylesInterface) => { return this.renderTrack(styles.trackHorizontal, this.props.hideHorizontalTrack, passedProps); }; - renderTrackVertical = (passedProps: any, styles: any) => { + renderTrackVertical = (passedProps: any, styles: StylesInterface) => { return this.renderTrack(styles.trackVertical, this.props.hideVerticalTrack, passedProps); }; - renderThumbHorizontal = (passedProps: any, styles: any) => { + renderThumbHorizontal = (passedProps: any, styles: StylesInterface) => { return
; }; - renderThumbVertical = (passedProps: any, styles: any) => { + renderThumbVertical = (passedProps: any, styles: StylesInterface) => { return
; }; - renderView = (passedProps: any, styles: any) => { + renderView = (passedProps: any, styles: StylesInterface) => { return
; }; @@ -115,7 +120,7 @@ export class CustomScrollbar extends Component { autoHideTimeout, hideTracksWhenNotNeeded, } = this.props; - const styles = getStyles(this.props.page); + const styles = getStyles(this.props.scrollbarStickLeft); return ( { export default CustomScrollbar; -const getStyles = (page?: boolean) => { +const getStyles = (scrollbarStickLeft?: boolean): StylesInterface => { return { customScrollbar: css` display: flex; @@ -157,7 +162,7 @@ const getStyles = (page?: boolean) => { trackVertical: css` border-radius: 3px; width: 8px !important; - right: ${page ? 0 : 2}px; + right: ${scrollbarStickLeft ? 0 : 2}px; bottom: 2px; `, trackHorizontal: css` diff --git a/public/app/core/components/Page/Page.tsx b/public/app/core/components/Page/Page.tsx index c61c2c4f890..c49498282f7 100644 --- a/public/app/core/components/Page/Page.tsx +++ b/public/app/core/components/Page/Page.tsx @@ -47,7 +47,7 @@ class Page extends Component { const { navModel, children, ...otherProps } = this.props; return (
- +
{children} diff --git a/public/app/features/dashboard/containers/DashboardPage.tsx b/public/app/features/dashboard/containers/DashboardPage.tsx index d5a2070607a..1b0c3142e2c 100644 --- a/public/app/features/dashboard/containers/DashboardPage.tsx +++ b/public/app/features/dashboard/containers/DashboardPage.tsx @@ -316,7 +316,7 @@ export class DashboardPage extends PureComponent { scrollTop={updateScrollTop} hideHorizontalTrack={true} updateAfterMountMs={500} - page={true} + scrollbarStickLeft={true} >
{initError && this.renderInitFailedState()} diff --git a/public/app/features/explore/Wrapper.tsx b/public/app/features/explore/Wrapper.tsx index 7cd1bfb3296..0cc919cc305 100644 --- a/public/app/features/explore/Wrapper.tsx +++ b/public/app/features/explore/Wrapper.tsx @@ -31,7 +31,7 @@ export class Wrapper extends Component { return (
- +