Refactored components styling 1/?
This commit is contained in:
1 parent
e72212a467
commit
8b27bc2ab2
20 files changed
+278
-197
No files matched your search
@@ -1,19 +0,0 @@
|
||||
.area-tooltip {
|
||||
background-color: white;
|
||||
border: solid 1px var(--border-color);
|
||||
border-radius: var(--env-var-radius-1);
|
||||
padding: var(--env-var-spacing-1) var(--env-var-spacing-2);
|
||||
}
|
||||
.area-tooltip p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.area-tooltip p:first-of-type {
|
||||
color: var(--theme-main);
|
||||
font-size: var(--env-var-font-size-medium);
|
||||
}
|
||||
.area-tooltip p:last-of-type {
|
||||
margin-top: 5px;
|
||||
color: var(--secondary-color);
|
||||
font-size: var(--env-var-font-size-small);
|
||||
}
|
||||
@@ -1,12 +1,31 @@
|
||||
import PropTypes from "prop-types";
|
||||
import { AreaChart, Area, XAxis, Tooltip, ResponsiveContainer } from "recharts";
|
||||
import { Box, Typography } from "@mui/material";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import "./index.css";
|
||||
|
||||
const CustomToolTip = ({ active, payload, label }) => {
|
||||
const theme = useTheme();
|
||||
|
||||
if (active && payload && payload.length) {
|
||||
return (
|
||||
<div className="area-tooltip">
|
||||
<p>
|
||||
<Box
|
||||
className="area-tooltip"
|
||||
sx={{
|
||||
backgroundColor: theme.palette.background.main,
|
||||
border: 1,
|
||||
borderColor: theme.palette.border.dark,
|
||||
borderRadius: theme.shape.borderRadius,
|
||||
py: theme.spacing(6),
|
||||
px: theme.spacing(8),
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
sx={{
|
||||
color: theme.palette.common.main,
|
||||
fontSize: 13,
|
||||
}}
|
||||
>
|
||||
{new Date(label).toLocaleDateString("en-US", {
|
||||
weekday: "short", // Mon
|
||||
month: "long", // July
|
||||
@@ -18,10 +37,18 @@ const CustomToolTip = ({ active, payload, label }) => {
|
||||
minute: "2-digit", // 15
|
||||
hour12: true, // AM/PM format
|
||||
})}
|
||||
</p>
|
||||
<p>Response Time (ms): {payload[0].payload.originalResponseTime}</p>{" "}
|
||||
</Typography>
|
||||
<Typography
|
||||
mt={theme.spacing(2.5)}
|
||||
sx={{
|
||||
color: theme.palette.text.secondary,
|
||||
fontSize: 13,
|
||||
}}
|
||||
>
|
||||
Response Time (ms): {payload[0].payload.originalResponseTime}
|
||||
</Typography>{" "}
|
||||
{/* Display original value */}
|
||||
</div>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user