Implement styling to match Figma designs
This commit is contained in:
1 parent
fec0081ea5
commit
b72fbc4599
4 files changed
+54
-61
No files matched your search
@@ -72,7 +72,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.MuiPaper-root + .MuiPagination-root {
|
.MuiPaper-root + .MuiPagination-root {
|
||||||
margin-top: 35px;
|
margin-top: 24px;
|
||||||
border: solid 1px var(--env-var-color-16);
|
border: solid 1px var(--env-var-color-16);
|
||||||
border-radius: var(--env-var-radius-1);
|
border-radius: var(--env-var-radius-1);
|
||||||
padding: var(--env-var-spacing-1-plus) var(--env-var-spacing-2);
|
padding: var(--env-var-spacing-1-plus) var(--env-var-spacing-2);
|
||||||
|
|||||||
@@ -1,13 +1,4 @@
|
|||||||
import {
|
import { BarChart, Bar, Cell, ReferenceLine, Label } from "recharts";
|
||||||
BarChart,
|
|
||||||
Bar,
|
|
||||||
XAxis,
|
|
||||||
YAxis,
|
|
||||||
Cell,
|
|
||||||
ResponsiveContainer,
|
|
||||||
ReferenceLine,
|
|
||||||
Label,
|
|
||||||
} from "recharts";
|
|
||||||
|
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
@@ -23,34 +14,32 @@ const MonitorDetails60MinChart = ({ data }) => {
|
|||||||
undefined: "var(--env-var-color-33)",
|
undefined: "var(--env-var-color-33)",
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<ResponsiveContainer width="100%" height={35}>
|
<BarChart
|
||||||
<BarChart
|
width={data.length * 10 + 30}
|
||||||
height={20}
|
height={35}
|
||||||
data={data}
|
data={data}
|
||||||
margin={{ top: 15, left: 15, right: 15, bottom: 0 }}
|
margin={{ top: 14, left: 15, right: 15, bottom: 2 }}
|
||||||
|
style={{ alignSelf: "baseline" }}
|
||||||
|
>
|
||||||
|
<Bar dataKey="value" barSize={10}>
|
||||||
|
{data.map((check, index) => (
|
||||||
|
<Cell key={`cell-${index}`} fill={color[check.status]} />
|
||||||
|
))}
|
||||||
|
</Bar>
|
||||||
|
<ReferenceLine x={0} stroke="black" strokeDasharray="3 3">
|
||||||
|
<Label value="60 mins" position="top" style={labelStyle} />
|
||||||
|
</ReferenceLine>
|
||||||
|
<ReferenceLine
|
||||||
|
x={Math.floor(data.length * (2 / 3))}
|
||||||
|
stroke="black"
|
||||||
|
strokeDasharray="3 3"
|
||||||
>
|
>
|
||||||
<XAxis hide={true} />
|
<Label value="20 mins" position="top" style={labelStyle} />
|
||||||
<YAxis hide={true} domain={[0, 100]} />
|
</ReferenceLine>
|
||||||
<Bar dataKey="value" barSize={15}>
|
<ReferenceLine x={data.length - 1} stroke="black" strokeDasharray="3 3">
|
||||||
{data.map((check, index) => (
|
<Label value="now" position="top" style={labelStyle} />
|
||||||
<Cell key={`cell-${index}`} fill={color[check.status]} />
|
</ReferenceLine>
|
||||||
))}
|
</BarChart>
|
||||||
</Bar>
|
|
||||||
<ReferenceLine x={0} stroke="black" strokeDasharray="3 3">
|
|
||||||
<Label value="60 mins" position="top" style={labelStyle} />
|
|
||||||
</ReferenceLine>
|
|
||||||
<ReferenceLine
|
|
||||||
x={Math.floor(data.length * (2 / 3))}
|
|
||||||
stroke="black"
|
|
||||||
strokeDasharray="3 3"
|
|
||||||
>
|
|
||||||
<Label value="20 mins" position="top" style={labelStyle} />
|
|
||||||
</ReferenceLine>
|
|
||||||
<ReferenceLine x={data.length - 1} stroke="black" strokeDasharray="3 3">
|
|
||||||
<Label value="Now" position="top" style={labelStyle} />
|
|
||||||
</ReferenceLine>
|
|
||||||
</BarChart>
|
|
||||||
</ResponsiveContainer>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.monitor-details .stat-box {
|
.monitor-details .stat-box {
|
||||||
flex: 1;
|
flex: 1 20%;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
border: solid 1px;
|
border: solid 1px;
|
||||||
border-radius: var(--env-var-radius-1);
|
border-radius: var(--env-var-radius-1);
|
||||||
|
|||||||
@@ -163,12 +163,12 @@ const DetailsPage = () => {
|
|||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
level="tertiary"
|
level="tertiary"
|
||||||
label="Back to Monitors"
|
label="Back"
|
||||||
animate="slideLeft"
|
animate="slideLeft"
|
||||||
img={<WestRoundedIcon />}
|
img={<WestRoundedIcon />}
|
||||||
onClick={() => navigate("/monitors")}
|
onClick={() => navigate("/monitors")}
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: "#f4f4f4",
|
backgroundColor: theme.palette.otherColors.fillGray,
|
||||||
px: theme.gap.ml,
|
px: theme.gap.ml,
|
||||||
"& svg.MuiSvgIcon-root": {
|
"& svg.MuiSvgIcon-root": {
|
||||||
mr: theme.gap.small,
|
mr: theme.gap.small,
|
||||||
@@ -176,21 +176,24 @@ const DetailsPage = () => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Stack gap={theme.gap.xl} mt={theme.gap.medium}>
|
<Stack gap={theme.gap.large}>
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
gap={theme.gap.small}
|
gap={theme.gap.small}
|
||||||
mt={theme.gap.small}
|
mt={theme.gap.small}
|
||||||
alignItems={"end"}
|
alignItems="baseline"
|
||||||
>
|
>
|
||||||
{monitor?.status ? <GreenCheck /> : <RedCheck />}
|
{monitor?.status ? <GreenCheck /> : <RedCheck />}
|
||||||
<Typography component="h1" sx={{ lineHeight: 1 }}>
|
|
||||||
{monitor.url?.replace(/^https?:\/\//, "") || "..."}
|
|
||||||
</Typography>
|
|
||||||
<MonitorDetails60MinChart data={monitor.statusBar} />
|
|
||||||
</Stack>
|
|
||||||
<Stack direction="row" gap={theme.gap.small}>
|
|
||||||
<Box>
|
<Box>
|
||||||
|
<Stack direction="row">
|
||||||
|
<Typography
|
||||||
|
component="h1"
|
||||||
|
sx={{ lineHeight: 1, alignSelf: "flex-end" }}
|
||||||
|
>
|
||||||
|
{monitor.url?.replace(/^https?:\/\//, "") || "..."}
|
||||||
|
</Typography>
|
||||||
|
<MonitorDetails60MinChart data={monitor.statusBar} />
|
||||||
|
</Stack>
|
||||||
<Typography mt={theme.gap.small}>
|
<Typography mt={theme.gap.small}>
|
||||||
<Typography
|
<Typography
|
||||||
component="span"
|
component="span"
|
||||||
@@ -203,8 +206,6 @@ const DetailsPage = () => {
|
|||||||
Your site is {monitor?.status ? "up" : "down"}.
|
Your site is {monitor?.status ? "up" : "down"}.
|
||||||
</Typography>{" "}
|
</Typography>{" "}
|
||||||
Checking every {formatDurationRounded(monitor?.interval)}.
|
Checking every {formatDurationRounded(monitor?.interval)}.
|
||||||
Last time checked{" "}
|
|
||||||
{formatDurationRounded(monitor?.lastChecked)} ago.
|
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Button
|
<Button
|
||||||
@@ -235,23 +236,18 @@ const DetailsPage = () => {
|
|||||||
direction="row"
|
direction="row"
|
||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
gap={theme.gap.large}
|
gap={theme.gap.large}
|
||||||
|
flexWrap="wrap"
|
||||||
>
|
>
|
||||||
<StatBox
|
<StatBox
|
||||||
title="Currently up for"
|
title="Currently up for"
|
||||||
value={formatDuration(monitor?.uptimeDuration)}
|
value={formatDuration(monitor?.uptimeDuration)}
|
||||||
/>
|
/>
|
||||||
<StatBox
|
<StatBox
|
||||||
title="Last checked"
|
title="Last check"
|
||||||
value={`${formatDuration(monitor?.lastChecked)} ago`}
|
value={`${formatDuration(monitor?.lastChecked)} ago`}
|
||||||
/>
|
/>
|
||||||
<StatBox title="Incidents" value={monitor?.incidents} />
|
<StatBox title="Incidents" value={monitor?.incidents} />
|
||||||
<StatBox title="Certificate Expiry" value={certificateExpiry} />
|
<StatBox title="Certificate Expiry" value={certificateExpiry} />
|
||||||
</Stack>
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
justifyContent="space-between"
|
|
||||||
gap={theme.gap.large}
|
|
||||||
>
|
|
||||||
<StatBox
|
<StatBox
|
||||||
title="Latest response time"
|
title="Latest response time"
|
||||||
value={monitor?.latestResponseTime}
|
value={monitor?.latestResponseTime}
|
||||||
@@ -269,7 +265,7 @@ const DetailsPage = () => {
|
|||||||
.replace(/\.?0+$/, "")}%`}
|
.replace(/\.?0+$/, "")}%`}
|
||||||
/>
|
/>
|
||||||
<StatBox
|
<StatBox
|
||||||
title="Uptime(30 days)"
|
title="Uptime (30 days)"
|
||||||
value={`${parseFloat(monitor?.uptime30Days)
|
value={`${parseFloat(monitor?.uptime30Days)
|
||||||
.toFixed(2)
|
.toFixed(2)
|
||||||
.replace(/\.?0+$/, "")}%`}
|
.replace(/\.?0+$/, "")}%`}
|
||||||
@@ -281,7 +277,7 @@ const DetailsPage = () => {
|
|||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
mb={theme.gap.ml}
|
mb={theme.gap.ml}
|
||||||
>
|
>
|
||||||
<Typography component="h2" mb={theme.gap.small}>
|
<Typography component="h2" alignSelf="flex-end">
|
||||||
Response Times
|
Response Times
|
||||||
</Typography>
|
</Typography>
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
@@ -317,7 +313,15 @@ const DetailsPage = () => {
|
|||||||
/>
|
/>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Box sx={{ height: "200px" }}>
|
<Box
|
||||||
|
p={theme.gap.mlplus}
|
||||||
|
pb={theme.gap.xs}
|
||||||
|
backgroundColor={theme.palette.otherColors.white}
|
||||||
|
border={1}
|
||||||
|
borderColor={theme.palette.otherColors.graishWhite}
|
||||||
|
borderRadius={`${theme.shape.borderRadius}px`}
|
||||||
|
sx={{ height: "250px" }}
|
||||||
|
>
|
||||||
<MonitorDetailsAreaChart
|
<MonitorDetailsAreaChart
|
||||||
checks={[...monitor.checks].reverse()}
|
checks={[...monitor.checks].reverse()}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user