import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { withStyles } from '@material-ui/core/styles'; import DeleteIcon from '@material-ui/icons/Delete'; import ArchiveIcon from '@material-ui/icons/Archive'; import BookmarkIcon from '@material-ui/icons/Bookmark'; import FilterListIcon from '@material-ui/icons/FilterList'; import SearchIcon from '@material-ui/icons/Search'; import { Toolbar, Typography, IconButton, Tooltip, FormControl, Input, InputAdornment, } from '@material-ui/core'; import styles from './tableStyle-jss'; class TableToolbar extends React.Component { state = { showSearch: false, } toggleSearch() { this.setState({ showSearch: !this.state.showSearch }); } handleChange(event) { event.persist(); this.props.onUserInput(event.target.value); } render() { const { numSelected, classes, filterText } = this.props; const { showSearch } = this.state; return ( 0, })} >
{numSelected > 0 ? ( {numSelected} {' '} selected ) : ( Nutrition )}
{numSelected > 0 ? (
) : (
{showSearch && ( this.handleChange(event)} endAdornment={( )} /> ) } this.toggleSearch()} >
)}
); } } TableToolbar.propTypes = { classes: PropTypes.object.isRequired, filterText: PropTypes.string.isRequired, onUserInput: PropTypes.func.isRequired, numSelected: PropTypes.number.isRequired, }; export default withStyles(styles)(TableToolbar);