mirror of
https://github.com/dstotijn/hetty.git
synced 2025-07-01 18:47:29 -04:00
Tidy up admin
structure
This commit is contained in:
36
admin/src/lib/components/ResponseStatus.tsx
Normal file
36
admin/src/lib/components/ResponseStatus.tsx
Normal file
@ -0,0 +1,36 @@
|
||||
import { Typography } from "@mui/material";
|
||||
|
||||
import HttpStatusIcon from "./HttpStatusIcon";
|
||||
|
||||
import { HttpProtocol } from "lib/graphql/generated";
|
||||
|
||||
type ResponseStatusProps = {
|
||||
proto: HttpProtocol;
|
||||
statusCode: number;
|
||||
statusReason: string;
|
||||
};
|
||||
|
||||
function mapProto(proto: HttpProtocol): string {
|
||||
switch (proto) {
|
||||
case HttpProtocol.Http1:
|
||||
return "HTTP/1.1";
|
||||
case HttpProtocol.Http2:
|
||||
return "HTTP/2.0";
|
||||
default:
|
||||
return proto;
|
||||
}
|
||||
}
|
||||
|
||||
export default function ResponseStatus({ proto, statusCode, statusReason }: ResponseStatusProps): JSX.Element {
|
||||
return (
|
||||
<Typography variant="h6" style={{ fontSize: "1rem", whiteSpace: "nowrap" }}>
|
||||
<HttpStatusIcon status={statusCode} />{" "}
|
||||
<Typography component="span" color="textSecondary">
|
||||
<Typography component="span" color="textSecondary" style={{ fontFamily: "'JetBrains Mono', monospace" }}>
|
||||
{mapProto(proto)}
|
||||
</Typography>
|
||||
</Typography>{" "}
|
||||
{statusCode} {statusReason}
|
||||
</Typography>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user