2020-09-23 18:10:32 +02:00
|
|
|
import { green, orange, red } from "@material-ui/core/colors";
|
2020-09-21 21:46:44 +02:00
|
|
|
import FiberManualRecordIcon from "@material-ui/icons/FiberManualRecord";
|
|
|
|
|
|
|
|
function HttpStatusIcon({ status }: { status: number }): JSX.Element {
|
|
|
|
const style = { marginTop: "-.25rem", verticalAlign: "middle" };
|
|
|
|
switch (Math.floor(status / 100)) {
|
|
|
|
case 2:
|
|
|
|
case 3:
|
2020-09-23 23:43:20 +02:00
|
|
|
return <FiberManualRecordIcon style={{ ...style, color: green[400] }} />;
|
2020-09-21 21:46:44 +02:00
|
|
|
case 4:
|
|
|
|
return <FiberManualRecordIcon style={{ ...style, color: orange[400] }} />;
|
|
|
|
case 5:
|
|
|
|
return <FiberManualRecordIcon style={{ ...style, color: red[400] }} />;
|
|
|
|
default:
|
|
|
|
return <FiberManualRecordIcon style={style} />;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default HttpStatusIcon;
|