Commit 54ddaece by Torkel Ödegaard Committed by GitHub

Table: Fixing scrolling draging the vertical handle (#23311)

* Table: Fixing scrolling draging the vertical handle

* updated snapshots
parent 2e58a65e
...@@ -2,7 +2,6 @@ import React, { Component } from 'react'; ...@@ -2,7 +2,6 @@ import React, { Component } from 'react';
import isNil from 'lodash/isNil'; import isNil from 'lodash/isNil';
import classNames from 'classnames'; import classNames from 'classnames';
import Scrollbars from 'react-custom-scrollbars'; import Scrollbars from 'react-custom-scrollbars';
import { cx, css } from 'emotion';
interface Props { interface Props {
className?: string; className?: string;
...@@ -72,17 +71,11 @@ export class CustomScrollbar extends Component<Props> { ...@@ -72,17 +71,11 @@ export class CustomScrollbar extends Component<Props> {
} }
renderTrack = (track: 'track-vertical' | 'track-horizontal', hideTrack: boolean | undefined, passedProps: any) => { renderTrack = (track: 'track-vertical' | 'track-horizontal', hideTrack: boolean | undefined, passedProps: any) => {
return ( if (passedProps.style && hideTrack) {
<div passedProps.style.display = 'none';
{...passedProps} }
className={cx(
css` return <div {...passedProps} className={track} />;
visibility: ${hideTrack ? 'hidden' : 'visible'};
`,
track
)}
/>
);
}; };
renderThumb = (thumb: 'thumb-horizontal' | 'thumb-vertical', passedProps: any) => { renderThumb = (thumb: 'thumb-horizontal' | 'thumb-vertical', passedProps: any) => {
......
...@@ -37,7 +37,7 @@ exports[`CustomScrollbar renders correctly 1`] = ` ...@@ -37,7 +37,7 @@ exports[`CustomScrollbar renders correctly 1`] = `
</p> </p>
</div> </div>
<div <div
className="css-52gpmd track-horizontal" className="track-horizontal"
style={ style={
Object { Object {
"display": "none", "display": "none",
...@@ -58,7 +58,7 @@ exports[`CustomScrollbar renders correctly 1`] = ` ...@@ -58,7 +58,7 @@ exports[`CustomScrollbar renders correctly 1`] = `
/> />
</div> </div>
<div <div
className="css-52gpmd track-vertical" className="track-vertical"
style={ style={
Object { Object {
"display": "none", "display": "none",
......
...@@ -68,7 +68,7 @@ export const Table: FC<Props> = memo(({ data, height, onCellClick, width, column ...@@ -68,7 +68,7 @@ export const Table: FC<Props> = memo(({ data, height, onCellClick, width, column
return ( return (
<div {...getTableProps()} className={tableStyles.table}> <div {...getTableProps()} className={tableStyles.table}>
<CustomScrollbar> <CustomScrollbar hideVerticalTrack={true}>
{!noHeader && ( {!noHeader && (
<div> <div>
{headerGroups.map((headerGroup: HeaderGroup) => ( {headerGroups.map((headerGroup: HeaderGroup) => (
......
...@@ -220,7 +220,7 @@ exports[`ServerStats Should render table with stats 1`] = ` ...@@ -220,7 +220,7 @@ exports[`ServerStats Should render table with stats 1`] = `
</div> </div>
</div> </div>
<div <div
className="css-52gpmd track-horizontal" className="track-horizontal"
style={ style={
Object { Object {
"display": "none", "display": "none",
...@@ -241,7 +241,7 @@ exports[`ServerStats Should render table with stats 1`] = ` ...@@ -241,7 +241,7 @@ exports[`ServerStats Should render table with stats 1`] = `
/> />
</div> </div>
<div <div
className="css-52gpmd track-vertical" className="track-vertical"
style={ style={
Object { Object {
"display": "none", "display": "none",
......
...@@ -353,8 +353,8 @@ export class PanelInspector extends PureComponent<Props, State> { ...@@ -353,8 +353,8 @@ export class PanelInspector extends PureComponent<Props, State> {
return ( return (
<Drawer title={this.drawerHeader} width={drawerWidth} onClose={this.onDismiss}> <Drawer title={this.drawerHeader} width={drawerWidth} onClose={this.onDismiss}>
<TabContent className={styles.tabContent}> <TabContent className={styles.tabContent}>
{tab === InspectTab.Data && this.renderDataTab()}
<CustomScrollbar autoHeightMin="100%"> <CustomScrollbar autoHeightMin="100%">
{tab === InspectTab.Data && this.renderDataTab()}
{tab === InspectTab.Meta && this.renderMetadataInspector()} {tab === InspectTab.Meta && this.renderMetadataInspector()}
{tab === InspectTab.Request && this.renderRequestTab()} {tab === InspectTab.Request && this.renderRequestTab()}
{tab === InspectTab.Error && this.renderErrorTab(error)} {tab === InspectTab.Error && this.renderErrorTab(error)}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment