move things into components

This commit is contained in:
Nicholas Orlowsky 2022-10-23 11:45:07 -05:00
parent 970d589b86
commit 8456552f5a
No known key found for this signature in database
GPG key ID: 3845F78A73B14100
4 changed files with 69 additions and 63 deletions

View file

@ -0,0 +1,30 @@
import {Incident} from "../nws-api/types";
import ReactTooltip from "react-tooltip";
import React from "react";
export default function IncidentCard(props: {incident: Incident}) {
const severityText: string[] = [
"Low Severity means that this issue does not affect any services running on NWS.",
"Medium Severity means that this issue may cause some slowdowns or outages on some services.",
"High Severity means that this issue causes an outage on the entire NWS network or most of the services running on it."
];
let severityClass: string = props.incident.severity == 0 ? 'low' : (props.incident.severity == 1 ? 'med' : 'high');
let severityString: string = props.incident.severity == 0 ? 'Low' : (props.incident.severity == 1 ? 'Medium' : 'High');
return (
<div className={`row text-left nws-card`} style={{width: '75vw'}}>
<p className={"col-md-10 col-12 mb-2"}><b>{props.incident.title}</b></p>
<div className={`col-md-2 col-12 mb-2`}>
<div className={`severity-label w-max-content ${severityClass}-severity`}
data-tip={severityText[props.incident.severity]}>
<b>
{severityString} Severity
</b>
<ReactTooltip />
</div>
</div>
<p className={"mb-0"}>{props.incident.description}</p>
</div>
);
}