import { FC } from 'react'; import React from 'react'; import { TableHeadType } from './Types'; import { TableHead, TableRow, TableCell, Checkbox, TableSortLabel, makeStyles, Typography, } from '@material-ui/core'; const useStyles = makeStyles(theme => ({ visuallyHidden: { border: 0, clip: 'rect(0 0 0 0)', height: 1, margin: -1, overflow: 'hidden', padding: 0, position: 'absolute', top: 20, width: 1, }, tableCell: { // background: theme.palette.common.t, paddingLeft: theme.spacing(2), // borderBottom: 'none', }, tableHeader: { textTransform: 'capitalize', color: 'rgba(0, 0, 0, 0.6)', fontSize: '12.8px', }, tableRow: { // borderBottom: '1px solid rgba(0, 0, 0, 0.6);', }, })); const EnhancedTableHead: FC = props => { const { onSelectAllClick, order, orderBy, numSelected, rowCount, colDefinitions = [], onRequestSort, openCheckBox, } = props; const classes = useStyles(); const createSortHandler = (property: string) => (event: React.MouseEvent) => { onRequestSort(event, property); }; return ( {openCheckBox && ( 0 && numSelected < rowCount} checked={rowCount > 0 && numSelected === rowCount} onChange={onSelectAllClick} inputProps={{ 'aria-label': 'select all desserts' }} /> )} {colDefinitions.map(headCell => ( {headCell.label ? ( {headCell.label} {orderBy === headCell.id ? ( {order === 'desc' ? 'sorted descending' : 'sorted ascending'} ) : null} ) : ( {headCell.label} )} ))} ); }; export default EnhancedTableHead;