From aaf8dacfc62e3b11410725bd64e154b9c9fad0fa Mon Sep 17 00:00:00 2001 From: "George W. Walker" Date: Fri, 9 Aug 2019 00:31:33 -0500 Subject: [PATCH] Fix issue with width on custom filter component (#791) * Fix issue with custom component width Fix #790 * Switch to correct FormControl * Use Material UI prop for fullwidth, not style * Remove old flex styles --- src/components/TableFilter.js | 149 ++++++++++++++-------------------- 1 file changed, 63 insertions(+), 86 deletions(-) diff --git a/src/components/TableFilter.js b/src/components/TableFilter.js index 0ea4c2f6d..99e3697fb 100644 --- a/src/components/TableFilter.js +++ b/src/components/TableFilter.js @@ -1,4 +1,5 @@ import { Grid, GridList, GridListTile, TextField } from '@material-ui/core'; + import Button from '@material-ui/core/Button'; import Checkbox from '@material-ui/core/Checkbox'; import FormControl from '@material-ui/core/FormControl'; @@ -8,12 +9,12 @@ import Input from '@material-ui/core/Input'; import InputLabel from '@material-ui/core/InputLabel'; import ListItemText from '@material-ui/core/ListItemText'; import MenuItem from '@material-ui/core/MenuItem'; +import PropTypes from 'prop-types'; +import React from 'react'; import Select from '@material-ui/core/Select'; -import { withStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React from 'react'; +import { withStyles } from '@material-ui/core/styles'; export const defaultFilterStyles = theme => ({ root: { @@ -79,29 +80,8 @@ export const defaultFilterStyles = theme => ({ }, }, checked: {}, - /* selects */ - selectRoot: { - display: 'flex', - marginTop: '16px', - flexDirection: 'row', - flexWrap: 'wrap', - width: '100%', - height: '80%', - justifyContent: 'space-between', - }, - selectFormControl: { - flex: '1 1 calc(50% - 24px)', - }, - /* textField */ - textFieldRoot: { - display: 'flex', + gridListTile: { marginTop: '16px', - flexDirection: 'row', - flexWrap: 'wrap', - width: '100%', - }, - textFieldFormControl: { - flex: '1 1 calc(50% - 24px)', }, }); @@ -190,26 +170,25 @@ class TableFilter extends React.Component { const textLabels = options.textLabels.filter; return ( - -
- - {column.label} - }> - - {textLabels.all} + + + {column.label} + }> + + {textLabels.all} + + {filterData[index].map((filterValue, filterIndex) => ( + + {filterValue != null ? filterValue.toString() : ''} - {filterData[index].map((filterValue, filterIndex) => ( - - {filterValue != null ? filterValue.toString() : ''} - - ))} - - -
+ ))} + +
); } @@ -218,16 +197,15 @@ class TableFilter extends React.Component { const { classes, filterList } = this.props; return ( - -
- - this.handleTextFieldChange(event, index, column.name)} - /> - -
+ + + this.handleTextFieldChange(event, index, column.name)} + /> + ); } @@ -236,34 +214,33 @@ class TableFilter extends React.Component { const { classes, filterData, filterList } = this.props; return ( - -
- - {column.label} - }> - {filterData[index].map((filterValue, filterIndex) => ( - - = 0 ? true : false} - value={filterValue != null ? filterValue.toString() : ''} - className={classes.checkboxIcon} - classes={{ - root: classes.checkbox, - checked: classes.checked, - }} - /> - - - ))} - - -
+ + + {column.label} + }> + {filterData[index].map((filterValue, filterIndex) => ( + + = 0 ? true : false} + value={filterValue != null ? filterValue.toString() : ''} + className={classes.checkboxIcon} + classes={{ + root: classes.checkbox, + checked: classes.checked, + }} + /> + + + ))} + + ); } @@ -280,10 +257,10 @@ class TableFilter extends React.Component { } return ( - -
- {display(filterList, this.handleCustomChange, index, column)} -
+ + + {display(filterList, this.handleCustomChange, index, column)} + ); }