Skip to content

Commit 7aec28c

Browse files
committed
#1650 - abstract pills
1 parent ce061d4 commit 7aec28c

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* This file is part of NER's FinishLine and licensed under GNU AGPLv3.
3+
* See the LICENSE file in the repository root folder for details.
4+
*/
5+
6+
import Chip from '@mui/material/Chip';
7+
import { green, blue, red, grey, purple } from '@mui/material/colors';
8+
import { ChangeRequestStatus } from 'shared';
9+
import { ChangeRequestStatusTextPipe } from '../utils/enum-pipes';
10+
11+
const determineChangeRequestStatusPillColor = (status: ChangeRequestStatus) => {
12+
switch (status) {
13+
case ChangeRequestStatus.Implemented:
14+
return blue[600];
15+
case ChangeRequestStatus.Accepted:
16+
return green[600];
17+
case ChangeRequestStatus.Denied:
18+
return red[400];
19+
case ChangeRequestStatus.Open:
20+
return purple[400];
21+
default:
22+
return grey[500];
23+
}
24+
};
25+
26+
const ChangeRequestStatusPill = ({ status }: { status: ChangeRequestStatus }) => {
27+
const statusPillColor = determineChangeRequestStatusPillColor(status);
28+
return (
29+
<Chip
30+
size="small"
31+
label={ChangeRequestStatusTextPipe(status)}
32+
variant="filled"
33+
sx={{
34+
fontSize: 12,
35+
color: 'white',
36+
backgroundColor: statusPillColor,
37+
width: 100
38+
}}
39+
/>
40+
);
41+
};
42+
43+
export default ChangeRequestStatusPill;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Chip } from '@mui/material';
2+
import { ChangeRequestType } from 'shared';
3+
import { ChangeRequestTypeTextPipe } from '../utils/enum-pipes';
4+
import { red } from '@mui/material/colors';
5+
6+
const ChangeRequestTypePill = ({ type }: { type: ChangeRequestType }) => {
7+
return (
8+
<Chip
9+
size="small"
10+
label={ChangeRequestTypeTextPipe(type)}
11+
variant="filled"
12+
sx={{
13+
fontSize: 12,
14+
color: 'white',
15+
backgroundColor: red[600],
16+
width: 100
17+
}}
18+
/>
19+
);
20+
};
21+
22+
export default ChangeRequestTypePill;

0 commit comments

Comments
 (0)