Skip to content

Commit f88419a

Browse files
committed
custom styling; additional logging
1 parent d3e2c34 commit f88419a

2 files changed

Lines changed: 28 additions & 13 deletions

File tree

src/App.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ const styles = {
1212
height: '100%',
1313
backgroundColor: '#242424',
1414
},
15-
remove: {
16-
position: 'absolute',
17-
zIndex: 1,
18-
right: '10px',
19-
top: '10px',
20-
cursor: 'pointer'
21-
}
2215
}
2316

2417
class App extends Component {

src/TableRow.js

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Paper from '@material-ui/core/Paper';
33
import { Plugin, Template, TemplatePlaceholder } from "@devexpress/dx-react-core";
44
import { FilteringState, IntegratedFiltering, SortingState, IntegratedSorting } from '@devexpress/dx-react-grid';
55
import { Grid, VirtualTable, TableHeaderRow, TableFilterRow, DragDropProvider,
6-
TableColumnReordering, TableColumnResizing, ColumnChooser, TableColumnVisibility,
6+
TableColumnReordering, ColumnChooser, TableColumnVisibility,
77
Toolbar,
88
} from '@devexpress/dx-react-grid-material-ui';
99
import DateRange from '@material-ui/icons/DateRange';
@@ -12,13 +12,20 @@ import { withStyles } from '@material-ui/core/styles';
1212
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
1313
import { faTerminal } from '@fortawesome/free-solid-svg-icons'
1414
import IconButton from '@material-ui/core/IconButton';
15+
import Tooltip from '@material-ui/core/Tooltip';
1516

1617
const styles = theme => ({
1718
tableStriped: {
1819
'& tbody tr:nth-of-type(odd)': {
1920
backgroundColor: fade(theme.palette.primary.main, 0.15),
2021
},
2122
},
23+
headerCell: {
24+
'&': {
25+
color: '#000',
26+
fontWeight: 800,
27+
}
28+
},
2229
});
2330

2431
const FilterIcon = ({ type, ...restProps }) => {
@@ -33,8 +40,16 @@ const TableComponentBase = ({ classes, ...restProps }) => (
3340
/>
3441
);
3542

43+
const TableHeaderComponentBase = ({ classes, ...restProps }) => (
44+
<TableHeaderRow.Cell
45+
{...restProps}
46+
className={classes.headerCell}
47+
/>
48+
);
49+
3650
const Root = props => <Grid.Root {...props} style={{ height: '100%' }} />;
3751
export const TableComponent = withStyles(styles, { name: 'TableComponent' })(TableComponentBase);
52+
export const TableHeaderComponent = withStyles(styles, { name: 'TableHeaderComponent' })(TableHeaderComponentBase);
3853

3954
class TableRow extends React.PureComponent {
4055

@@ -57,9 +72,11 @@ class TableRow extends React.PureComponent {
5772
return (
5873
<Plugin name="customToolbarMarkup">
5974
<Template name="toolbarContent">
60-
<IconButton aria-label="Show Console" title="Show Console" onClick={() => handleVisibleChange(true)}>
61-
<FontAwesomeIcon icon={faTerminal} size="sm" />
62-
</IconButton>
75+
<Tooltip title="Show Console" aria-label="showConsole">
76+
<IconButton aria-label="consoleButton" onClick={() => handleVisibleChange(true)}>
77+
<FontAwesomeIcon icon={faTerminal} size="sm" />
78+
</IconButton>
79+
</Tooltip>
6380
<TemplatePlaceholder />
6481
</Template>
6582
</Plugin>)
@@ -88,15 +105,20 @@ class TableRow extends React.PureComponent {
88105
tableComponent={TableComponent}
89106
/>
90107
{/* <TableColumnResizing defaultColumnWidths /> */}
91-
<TableHeaderRow showSortingControls />
108+
<TableHeaderRow
109+
showSortingControls
110+
cellComponent={TableHeaderComponent}
111+
/>
92112
<TableColumnReordering
93113
defaultOrder={columns.map(column => column.name)}
94114
/>
95115
<TableFilterRow
96116
showFilterSelector
97117
iconComponent={FilterIcon}
98118
/>
99-
<TableColumnVisibility />
119+
<TableColumnVisibility
120+
onHiddenColumnNamesChange={change => console.info(`Columns filtered: ${change}`)}
121+
/>
100122
<Toolbar />
101123
<ColumnChooser />
102124
<CustomToolbarMarkup />

0 commit comments

Comments
 (0)