-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWaiverConfigSelect.tsx
More file actions
70 lines (65 loc) · 1.67 KB
/
WaiverConfigSelect.tsx
File metadata and controls
70 lines (65 loc) · 1.67 KB
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
import React from "react";
import { Button, Stack, Tooltip } from "@mui/material";
import localization from "../utilities/localization";
export interface Props {
/**
* Texts displayed on the buttons
*/
scoreMetricValues: {title: string, tooltip: string}[];
/**
* The useState Hook to transfer the choice
*/
selectedScoreMetricValue: {
value: string;
setValue: React.Dispatch<React.SetStateAction<string>>;
};
/**
* The option, that was found in the report file
*/
originalScoreMetricValue: string;
/**
* Margin of each box. Example: "0rem 1rem 0rem 0rem"
*/
margin: string;
}
export default function WaiverConfigSelect(props: Props) {
return (
<Stack sx={radioButtonBox}>
{props.scoreMetricValues.map((value) => (
<Tooltip title={value.tooltip}>
<Button
sx={radioButton(props, value.title)}
onClick={() => props.selectedScoreMetricValue.setValue(value.title)}
>
{value.title}
</Button>
</Tooltip>
))}
</Stack>
);
}
/**************
* Styles
**************/
const radioButtonBox = {};
const radioButton = (props: Props, label: string) => {
return {
border:
props.originalScoreMetricValue === label
? "2px solid #000000"
: "1px solid #00000080",
backgroundColor:
props.selectedScoreMetricValue.value === label
? "#00cb75"
: "transparent",
marginBottom: "0.5rem",
"&:hover": {
backgroundColor:
props.selectedScoreMetricValue.value === label ? "#00cb75" : "#2dfa87",
},
fontSize: "0.8rem",
fontWeight: 400,
minHeight: "24px",
minWidth: "96px",
};
};