Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | import React from "react"; import TableCell from "@mui/material/TableCell"; import TableHead from "@mui/material/TableHead"; import TableRow from "@mui/material/TableRow"; import TableSortLabel from "@mui/material/TableSortLabel"; import Checkbox from "@mui/material/Checkbox"; import { SortableField } from "../types"; import { useStyles, headCells } from "./ConceptsTable"; interface EnhancedTableProps { classes: ReturnType<typeof useStyles>; numSelected: number; onRequestSort: ( event: React.MouseEvent<unknown>, property: SortableField ) => void; onSelectAllClick: ( event: React.ChangeEvent<HTMLInputElement>, checked: boolean ) => void; order: "sortAsc" | "sortDesc"; orderBy: string; rowCount: number; } export function EnhancedTableHead(props: EnhancedTableProps) { const { classes, onSelectAllClick, order, orderBy, numSelected, rowCount, onRequestSort } = props; const createSortHandler = (property: SortableField) => ( event: React.MouseEvent<unknown> ) => { onRequestSort(event, property); }; return ( <TableHead data-testid="conceptsTableHeader"> <TableRow> {numSelected <= 0 ? null : ( <TableCell padding="checkbox"> <Checkbox indeterminate={numSelected > 0 && numSelected < rowCount} checked={numSelected === rowCount} onChange={onSelectAllClick} inputProps={{ "aria-label": "select all desserts" }} color="secondary" /> </TableCell> )} {headCells.map(headCell => ( <TableCell key={headCell.id} padding={headCell.disablePadding ? "none" : "normal"} sortDirection={ orderBy === headCell.id ? order === "sortAsc" ? "asc" : "desc" : false } > <TableSortLabel active={orderBy === headCell.id} direction={order === "sortAsc" ? "asc" : "desc"} onClick={createSortHandler(headCell.id)} > {headCell.label} {orderBy === headCell.id ? ( <span className={classes.visuallyHidden}> {order === "sortDesc" ? "sorted descending" : "sorted ascending"} </span> ) : null} </TableSortLabel> </TableCell> ))} <TableCell padding="checkbox" /> </TableRow> </TableHead> ); } |