forked from marmelab/react-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrowSx.tsx
44 lines (41 loc) · 1.18 KB
/
rowSx.tsx
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
import green from '@mui/material/colors/green';
import type { SxProps } from '@mui/material';
import orange from '@mui/material/colors/orange';
import red from '@mui/material/colors/red';
import { Identifier } from 'react-admin';
import { Review } from './../types';
const rowSx = (selectedRow?: Identifier) => (record: Review): SxProps => {
let style = {};
if (!record) {
return style;
}
if (selectedRow && selectedRow === record.id) {
style = {
...style,
backgroundColor: 'action.selected',
};
}
if (record.status === 'accepted')
return {
...style,
borderLeftColor: green[500],
borderLeftWidth: 5,
borderLeftStyle: 'solid',
};
if (record.status === 'pending')
return {
...style,
borderLeftColor: orange[500],
borderLeftWidth: 5,
borderLeftStyle: 'solid',
};
if (record.status === 'rejected')
return {
...style,
borderLeftColor: red[500],
borderLeftWidth: 5,
borderLeftStyle: 'solid',
};
return style;
};
export default rowSx;