forked from zmc/pulpito-ng
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Replace @mui/x-data-grid with material-react-table
- Loading branch information
Showing
4 changed files
with
148 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { MaterialReactTable } from 'material-react-table'; | ||
|
||
|
||
export default function Table (props) { | ||
return ( | ||
<MaterialReactTable | ||
initialState={{ | ||
density: "compact", | ||
}} | ||
muiTableBodyRowProps={({row}) => { | ||
const colors = { | ||
"finished fail": "error", | ||
"running": "warning", | ||
"finished pass": "success", | ||
}; | ||
const backgroundColor = colors[row.original.status] || "info"; | ||
return {sx: { | ||
color: "black", | ||
backgroundColor: backgroundColor + ".main", | ||
"&:hover": { | ||
backgroundColor: backgroundColor + ".light", | ||
}, | ||
"&:selected": { | ||
backgroundColor: backgroundColor + ".dark", | ||
}, | ||
}}; | ||
}} | ||
muiTableBodyCellProps={{ | ||
sx: { | ||
color: "black", | ||
fontSize: "0.75rem", | ||
} | ||
}} | ||
data={props.rows} | ||
{...props} | ||
/> | ||
) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters