Refactored components styling 1/?

This commit is contained in:
Daniel Cojocea committed 2024-08-27 12:18:25 -04:00
1 parent e72212a467
commit 8b27bc2ab2
20 files changed
+278 -197

No files matched your search

+11 -13
View File
@@ -32,7 +32,7 @@ const icons = {
const Alert = ({ variant, title, body, isToast, hasIcon = true, onClick }) => { const Alert = ({ variant, title, body, isToast, hasIcon = true, onClick }) => {
const theme = useTheme(); const theme = useTheme();
const { bg, border, color } = theme.alert[variant]; const { text, light, border } = theme.palette[variant];
const icon = icons[variant]; const icon = icons[variant];
return ( return (
@@ -41,23 +41,25 @@ const Alert = ({ variant, title, body, isToast, hasIcon = true, onClick }) => {
justifyContent="flex-start" justifyContent="flex-start"
alignItems={hasIcon ? "" : "center"} alignItems={hasIcon ? "" : "center"}
className="alert row-stack" className="alert row-stack"
gap={theme.gap.ml} gap={theme.spacing(8)}
sx={{ sx={{
padding: hasIcon ? theme.gap.ml : `${theme.gap.small} ${theme.gap.ml}`, padding: hasIcon
backgroundColor: bg, ? theme.spacing(8)
: `${theme.spacing(4)} ${theme.spacing(8)}`,
backgroundColor: light,
border: `solid 1px ${border}`, border: `solid 1px ${border}`,
borderRadius: `${theme.shape.borderRadius}px`, borderRadius: theme.shape.borderRadius,
}} }}
> >
{hasIcon && <Box sx={{ color: color }}>{icon}</Box>} {hasIcon && <Box sx={{ color: text }}>{icon}</Box>}
<Stack direction="column" gap="2px" sx={{ flex: 1 }}> <Stack direction="column" gap="2px" sx={{ flex: 1 }}>
{title && ( {title && (
<Typography sx={{ fontWeight: "700", color: `${color} !important` }}> <Typography sx={{ fontWeight: "700", color: `${text}` }}>
{title} {title}
</Typography> </Typography>
)} )}
{body && ( {body && (
<Typography sx={{ fontWeight: "400", color: `${color} !important` }}> <Typography sx={{ fontWeight: "400", color: `${text}` }}>
{body} {body}
</Typography> </Typography>
)} )}
@@ -69,7 +71,7 @@ const Alert = ({ variant, title, body, isToast, hasIcon = true, onClick }) => {
sx={{ sx={{
fontWeight: "600", fontWeight: "600",
width: "fit-content", width: "fit-content",
mt: theme.gap.small, mt: theme.spacing(4),
padding: 0, padding: 0,
minWidth: 0, minWidth: 0,
"&:hover": { "&:hover": {
@@ -95,10 +97,6 @@ const Alert = ({ variant, title, body, isToast, hasIcon = true, onClick }) => {
"&:focus": { "&:focus": {
outline: "none", outline: "none",
}, },
"& .MuiTouchRipple-root": {
pointerEvents: "none",
display: "none",
},
}} }}
> >
<CloseIcon <CloseIcon
+3 -53
View File
@@ -17,8 +17,6 @@
.MuiPaper-root:has(table.MuiTable-root) { .MuiPaper-root:has(table.MuiTable-root) {
box-shadow: none; box-shadow: none;
border: solid 1px var(--border-color);
border-radius: var(--env-var-radius-1);
} }
.MuiTable-root .MuiTable-root
.MuiTableBody-root .MuiTableBody-root
@@ -26,10 +24,7 @@
.MuiTableCell-root { .MuiTableCell-root {
border: none; border: none;
} }
.MuiTable-root .MuiTableHead-root,
.MuiTable-root .MuiTableRow-root:hover {
background-color: var(--primary-bg-accent);
}
.MuiTable-root .MuiTableHead-root .MuiTableCell-root, .MuiTable-root .MuiTableHead-root .MuiTableCell-root,
.MuiTable-root .MuiTableBody-root .MuiTableCell-root { .MuiTable-root .MuiTableBody-root .MuiTableCell-root {
font-size: var(--env-var-font-size-medium); font-size: var(--env-var-font-size-medium);
@@ -37,7 +32,6 @@
.MuiTable-root .MuiTableHead-root .MuiTableCell-root { .MuiTable-root .MuiTableHead-root .MuiTableCell-root {
padding: var(--env-var-spacing-1) var(--env-var-spacing-2); padding: var(--env-var-spacing-1) var(--env-var-spacing-2);
font-weight: 500; font-weight: 500;
color: var(--secondary-color-light);
} }
.MuiTable-root .MuiTableHead-root span { .MuiTable-root .MuiTableHead-root span {
display: inline-block; display: inline-block;
@@ -52,7 +46,6 @@
height: 20px; height: 20px;
} }
.MuiTable-root .MuiTableBody-root .MuiTableCell-root { .MuiTable-root .MuiTableBody-root .MuiTableCell-root {
color: var(--secondary-color);
padding: 6px var(--env-var-spacing-2); padding: 6px var(--env-var-spacing-2);
} }
.MuiTable-root .MuiTableBody-root .MuiTableRow-root { .MuiTable-root .MuiTableBody-root .MuiTableRow-root {
@@ -61,21 +54,14 @@
.MuiPaper-root + .MuiPagination-root { .MuiPaper-root + .MuiPagination-root {
margin-top: 24px; margin-top: 24px;
background-color: var(--primary-bg);
border: solid 1px var(--border-color);
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);
} }
.MuiPaper-root + .MuiPagination-root ul { .MuiPaper-root + .MuiPagination-root ul {
justify-content: center; justify-content: center;
} }
.MuiPaper-root .MuiPaper-root + .MuiPagination-root button {
+ .MuiPagination-root
ul
li:not(:first-child):not(:last-child)
button {
font-size: var(--env-var-font-size-medium); font-size: var(--env-var-font-size-medium);
color: var(--secondary-color);
font-weight: 500; font-weight: 500;
} }
.MuiPaper-root + .MuiPagination-root ul li:first-child { .MuiPaper-root + .MuiPagination-root ul li:first-child {
@@ -84,11 +70,6 @@
.MuiPaper-root + .MuiPagination-root ul li:last-child { .MuiPaper-root + .MuiPagination-root ul li:last-child {
margin-left: auto; margin-left: auto;
} }
.MuiPaper-root + .MuiPagination-root ul li:first-child button,
.MuiPaper-root + .MuiPagination-root ul li:last-child button {
border: solid 1px var(--border-color);
border-radius: var(--env-var-radius-1);
}
.MuiPaper-root + .MuiPagination-root ul li:first-child button { .MuiPaper-root + .MuiPagination-root ul li:first-child button {
padding: 0 var(--env-var-spacing-1) 0 var(--env-var-spacing-1-plus); padding: 0 var(--env-var-spacing-1) 0 var(--env-var-spacing-1-plus);
} }
@@ -108,23 +89,14 @@
content: "Next"; content: "Next";
margin-right: 15px; margin-right: 15px;
} }
.MuiPaper-root + .MuiPagination-root .MuiPaginationItem-root.Mui-selected {
background-color: var(--primary-bg-fill);
}
.MuiPaper-root + .MuiPagination-root div.MuiPaginationItem-root { .MuiPaper-root + .MuiPagination-root div.MuiPaginationItem-root {
user-select: none; user-select: none;
} }
.MuiTablePagination-root p { .MuiTablePagination-root p {
color: var(--secondary-color-light);
font-weight: 500; font-weight: 500;
font-size: var(--env-var-font-size-small-plus); font-size: var(--env-var-font-size-small-plus);
} }
.MuiTablePagination-root button,
.MuiTablePagination-root .MuiSelect-select {
border: solid 1px var(--border-color);
border-radius: var(--env-var-radius-1);
}
.MuiTablePagination-root .MuiTablePagination-select.MuiSelect-select { .MuiTablePagination-root .MuiTablePagination-select.MuiSelect-select {
text-align: left; text-align: left;
text-align-last: left; text-align-last: left;
@@ -138,10 +110,6 @@
width: 22px; width: 22px;
height: 22px; height: 22px;
} }
.MuiTablePagination-root svg path {
stroke: var(--secondary-color-light);
stroke-width: 1.3;
}
.MuiTablePagination-root .MuiSelect-icon { .MuiTablePagination-root .MuiSelect-icon {
width: 16px; width: 16px;
height: 16px; height: 16px;
@@ -152,30 +120,13 @@
.MuiTablePagination-root button.Mui-disabled { .MuiTablePagination-root button.Mui-disabled {
opacity: 0.4; opacity: 0.4;
} }
.MuiTablePagination-root button:not(.Mui-disabled):hover {
background-color: var(--primary-bg-fill);
border-color: var(--primary-bg-fill);
}
.pagination-dropdown.MuiPaper-root {
box-shadow: var(--env-var-shadow-1);
border: solid 1px var(--border-color);
border-radius: var(--env-var-radius-1);
}
.pagination-dropdown ul { .pagination-dropdown ul {
padding: 4px; padding: 4px;
min-width: 100px; min-width: 100px;
} }
.pagination-dropdown li, .pagination-dropdown li {
body:has(.pagination-dropdown) p:has(+ .MuiTablePagination-root) {
font-size: var(--env-var-font-size-medium); font-size: var(--env-var-font-size-medium);
color: var(--secondary-color-light);
padding: 4px;
}
.pagination-dropdown li.Mui-selected,
.pagination-dropdown li.Mui-selected.Mui-focusVisible,
.pagination-dropdown li.Mui-selected:hover {
background-color: var(--primary-bg-fill);
} }
body:has(.pagination-dropdown) p:has(+ .MuiTablePagination-root) { body:has(.pagination-dropdown) p:has(+ .MuiTablePagination-root) {
font-size: var(--env-var-font-size-small-plus); font-size: var(--env-var-font-size-small-plus);
@@ -183,7 +134,6 @@ body:has(.pagination-dropdown) p:has(+ .MuiTablePagination-root) {
.monitors .MuiTable-root .MuiTableHead-root .MuiTableCell-root { .monitors .MuiTable-root .MuiTableHead-root .MuiTableCell-root {
text-transform: uppercase; text-transform: uppercase;
color: var(--secondary-color);
opacity: 0.8; opacity: 0.8;
font-size: var(--env-var-font-size-small-plus); font-size: var(--env-var-font-size-small-plus);
font-weight: 400; font-weight: 400;
+73 -12
View File
@@ -200,12 +200,29 @@ const BasicTable = ({ data, paginated, reversed, table }) => {
return ( return (
<> <>
<TableContainer component={Paper}> <TableContainer
component={Paper}
sx={{
border: `solid 1px ${theme.palette.border.light}`,
borderRadius: theme.shape.borderRadius,
}}
>
<Table> <Table>
<TableHead> <TableHead
sx={{
backgroundColor: theme.palette.background.accent,
}}
>
<TableRow> <TableRow>
{data.cols.map((col) => ( {data.cols.map((col) => (
<TableCell key={col.id}>{col.name}</TableCell> <TableCell
key={col.id}
sx={{
color: theme.palette.text.secondary,
}}
>
{col.name}
</TableCell>
))} ))}
</TableRow> </TableRow>
</TableHead> </TableHead>
@@ -215,12 +232,24 @@ const BasicTable = ({ data, paginated, reversed, table }) => {
<TableRow <TableRow
sx={{ sx={{
cursor: row.handleClick ? "pointer" : "default", cursor: row.handleClick ? "pointer" : "default",
"&:hover": {
backgroundColor: theme.palette.background.accent,
},
}} }}
key={row.id} key={row.id}
onClick={row.handleClick ? row.handleClick : null} onClick={row.handleClick ? row.handleClick : null}
> >
{row.data.map((cell) => { {row.data.map((cell) => {
return <TableCell key={cell.id}>{cell.data}</TableCell>; return (
<TableCell
key={cell.id}
sx={{
color: theme.palette.text.secondary,
}}
>
{cell.data}
</TableCell>
);
})} })}
</TableRow> </TableRow>
); );
@@ -233,9 +262,14 @@ const BasicTable = ({ data, paginated, reversed, table }) => {
direction="row" direction="row"
alignItems="center" alignItems="center"
justifyContent="space-between" justifyContent="space-between"
px={theme.gap.small} px={theme.spacing(4)}
sx={{
"& p": {
color: theme.palette.text.tertiary,
},
}}
> >
<Typography sx={{ opacity: 0.7 }}> <Typography px={theme.spacing(2)} sx={{ opacity: 0.7 }}>
Showing {getRange()} of {data.rows.length} monitor(s) Showing {getRange()} of {data.rows.length} monitor(s)
</Typography> </Typography>
<TablePagination <TablePagination
@@ -260,6 +294,20 @@ const BasicTable = ({ data, paginated, reversed, table }) => {
keepMounted: true, keepMounted: true,
PaperProps: { PaperProps: {
className: "pagination-dropdown", className: "pagination-dropdown",
sx: {
border: 1,
borderColor: theme.palette.border.light,
borderRadius: theme.shape.borderRadius,
boxShadow: theme.shape.boxShadow,
"& li": {
p: theme.spacing(2),
color: theme.palette.text.tertiary,
},
"& li.Mui-selected, & li.Mui-selected.Mui-focusVisible, & li.Mui-selected:hover":
{
backgroundColor: theme.palette.background.fill,
},
},
}, },
transformOrigin: { vertical: "bottom", horizontal: "left" }, transformOrigin: { vertical: "bottom", horizontal: "left" },
anchorOrigin: { vertical: "top", horizontal: "left" }, anchorOrigin: { vertical: "top", horizontal: "left" },
@@ -268,19 +316,32 @@ const BasicTable = ({ data, paginated, reversed, table }) => {
inputProps: { id: "pagination-dropdown" }, inputProps: { id: "pagination-dropdown" },
IconComponent: SelectorVertical, IconComponent: SelectorVertical,
sx: { sx: {
ml: theme.gap.small, ml: theme.spacing(4),
mr: theme.gap.large, mr: theme.spacing(12),
minWidth: theme.gap.xl, minWidth: theme.spacing(20),
textAlign: "left", textAlign: "left",
"&.Mui-focused > div": { "&.Mui-focused > div": {
backgroundColor: theme.palette.otherColors.white, backgroundColor: theme.palette.background.main,
}, },
}, },
}, },
}} }}
sx={{ sx={{
mt: theme.gap.medium, mt: theme.spacing(6),
color: theme.palette.otherColors.bluishGray, color: theme.palette.text.secondary,
"& button, & .MuiSelect-select": {
border: 1,
borderColor: theme.palette.border.light,
borderRadius: theme.shape.borderRadius,
},
"& svg path": {
stroke: theme.palette.text.tertiary,
strokeWidth: 1.3,
},
"& button:not(.Mui-disabled):hover": {
backgroundColor: theme.palette.background.fill,
borderColor: theme.palette.background.fill,
},
}} }}
/> />
</Stack> </Stack>
+1 -10
View File
@@ -1,5 +1,5 @@
.MuiBreadcrumbs-root { .MuiBreadcrumbs-root {
height: 36px; height: 34px;
} }
.MuiBreadcrumbs-root svg { .MuiBreadcrumbs-root svg {
width: 16px; width: 16px;
@@ -7,17 +7,8 @@
} }
.MuiBreadcrumbs-root .MuiBreadcrumbs-li a { .MuiBreadcrumbs-root .MuiBreadcrumbs-li a {
font-size: var(--env-var-font-size-medium); font-size: var(--env-var-font-size-medium);
color: var(--secondary-color-light);
opacity: 0.8;
font-weight: 400; font-weight: 400;
} }
.MuiBreadcrumbs-root .MuiBreadcrumbs-li:hover a {
color: var(--secondary-color-light);
}
.MuiBreadcrumbs-root .MuiBreadcrumbs-li:not(:last-child):hover a {
opacity: 1;
background-color: #e3e3e3;
}
.MuiBreadcrumbs-root .MuiBreadcrumbs-li:not(:last-child) { .MuiBreadcrumbs-root .MuiBreadcrumbs-li:not(:last-child) {
cursor: pointer; cursor: pointer;
} }
+21 -8
View File
@@ -25,23 +25,36 @@ const Breadcrumbs = ({ list }) => {
<MUIBreadcrumbs <MUIBreadcrumbs
separator={<ArrowRight />} separator={<ArrowRight />}
aria-label="breadcrumb" aria-label="breadcrumb"
p={theme.gap.small} px={theme.spacing(2)}
py={theme.spacing(3.5)}
width="fit-content" width="fit-content"
backgroundColor={theme.palette.otherColors.fillGray} backgroundColor={theme.palette.background.fill}
borderRadius={`${theme.shape.borderRadius}px`} borderRadius={theme.shape.borderRadius}
lineHeight="18px" lineHeight="18px"
sx={{
"& .MuiBreadcrumbs-li:not(:last-of-type):hover a": {
backgroundColor: "#e3e3e3",
opacity: 1,
},
}}
> >
{list.map((item, index) => { {list.map((item, index) => {
return ( return (
<Box <Box
component="a" component="a"
key={`${item.name}-${index}`} key={`${item.name}-${index}`}
px={theme.gap.small} px={theme.spacing(4)}
pt={theme.gap.xs} pt={theme.spacing(2)}
pb="6px" pb={theme.spacing(3)}
sx={{ textTransform: "capitalize" }} borderRadius={theme.shape.borderRadius}
borderRadius={`${theme.shape.borderRadius}px`}
onClick={() => navigate(item.path)} onClick={() => navigate(item.path)}
sx={{
opacity: 0.8,
textTransform: "capitalize",
"&, &:hover": {
color: theme.palette.text.tertiary,
},
}}
> >
{item.name} {item.name}
</Box> </Box>
+1
View File
@@ -77,6 +77,7 @@ const Button = ({
fontWeight: 400, fontWeight: 400,
boxShadow: "none", boxShadow: "none",
textTransform: "none", textTransform: "none",
borderRadius: "4px",
"&:focus": { "&:focus": {
outline: "none", outline: "none",
}, },
@@ -74,12 +74,13 @@ const ButtonSpinner = ({
sx={{ sx={{
boxShadow: "none", boxShadow: "none",
textTransform: "none", textTransform: "none",
borderRadius: "4px",
"&:focus": { "&:focus": {
outline: "none", outline: "none",
}, },
"&:hover": { "&:hover": {
boxShadow: "none", boxShadow: "none",
transition: "none" transition: "none",
}, },
...sx, ...sx,
}} }}
@@ -1,19 +0,0 @@
.bar-tooltip .MuiTooltip-tooltip {
background-color: white;
border: solid 1px black;
box-shadow: var(--env-var-shadow-1);
border: solid 1px var(--env-var-color-6);
border-radius: var(--env-var-radius-1);
padding: 4px 8px;
}
.bar-tooltip .MuiTooltip-tooltip p {
font-size: var(--env-var-font-size-small-plus);
color: var(--secondary-color-light);
font-weight: 500;
}
.bar-tooltip .MuiTooltip-tooltip span {
font-size: var(--env-var-font-size-small);
color: var(--secondary-color-light);
font-weight: 600;
}
+37 -16
View File
@@ -26,7 +26,7 @@ const BarChart = ({ checks = [] }) => {
<Stack <Stack
direction="row" direction="row"
flexWrap="nowrap" flexWrap="nowrap"
gap="3px" gap={theme.spacing(1.5)}
height="50px" height="50px"
width="fit-content" width="fit-content"
onClick={(event) => event.stopPropagation()} onClick={(event) => event.stopPropagation()}
@@ -39,11 +39,11 @@ const BarChart = ({ checks = [] }) => {
<Box <Box
key={`${check}-${index}`} key={`${check}-${index}`}
position="relative" position="relative"
width="9px" width={theme.spacing(4.5)}
height="100%" height="100%"
backgroundColor={theme.palette.otherColors.fillGray} backgroundColor={theme.palette.background.fill}
sx={{ sx={{
borderRadius: "3px", borderRadius: theme.spacing(1.5),
}} }}
/> />
) : ( ) : (
@@ -53,15 +53,15 @@ const BarChart = ({ checks = [] }) => {
<Typography> <Typography>
{formatDate(new Date(check.createdAt), { year: undefined })} {formatDate(new Date(check.createdAt), { year: undefined })}
</Typography> </Typography>
<Box mt={theme.gap.xs}> <Box mt={theme.spacing(2)}>
<Box <Box
display="inline-block" display="inline-block"
width={theme.gap.small} width={theme.spacing(4)}
height={theme.gap.small} height={theme.spacing(4)}
backgroundColor={ backgroundColor={
check.status check.status
? theme.label.up.dotColor ? theme.palette.success.main
: theme.label.down.dotColor : theme.palette.error.text
} }
sx={{ borderRadius: "50%" }} sx={{ borderRadius: "50%" }}
/> />
@@ -69,8 +69,8 @@ const BarChart = ({ checks = [] }) => {
display="inline-flex" display="inline-flex"
direction="row" direction="row"
justifyContent="space-between" justifyContent="space-between"
ml={theme.gap.xs} ml={theme.spacing(2)}
gap={theme.gap.large} gap={theme.spacing(12)}
> >
<Typography component="span" sx={{ opacity: 0.8 }}> <Typography component="span" sx={{ opacity: 0.8 }}>
Response Time Response Time
@@ -99,6 +99,27 @@ const BarChart = ({ checks = [] }) => {
}, },
}, },
], ],
sx: {
"& .MuiTooltip-tooltip": {
backgroundColor: theme.palette.background.main,
border: 1,
borderColor: theme.palette.border.dark,
borderRadius: theme.shape.borderRadius,
boxShadow: theme.shape.boxShadow,
px: theme.spacing(4),
py: theme.spacing(2),
},
"& .MuiTooltip-tooltip p": {
fontSize: 12,
color: theme.palette.text.tertiary,
fontWeight: 500,
},
"& .MuiTooltip-tooltip span": {
fontSize: 11,
color: theme.palette.text.tertiary,
fontWeight: 600,
},
},
}, },
}} }}
> >
@@ -107,10 +128,10 @@ const BarChart = ({ checks = [] }) => {
width="9px" width="9px"
height="100%" height="100%"
backgroundColor={ backgroundColor={
check.status ? theme.label.up.bgColor : theme.label.down.bgColor check.status ? theme.palette.success.bg : theme.palette.error.bg
} }
sx={{ sx={{
borderRadius: "3px", borderRadius: theme.spacing(1.5),
"&:hover > .MuiBox-root": { "&:hover > .MuiBox-root": {
filter: "brightness(0.8)", filter: "brightness(0.8)",
}, },
@@ -123,11 +144,11 @@ const BarChart = ({ checks = [] }) => {
height={`${animate ? check.responseTime : 0}%`} height={`${animate ? check.responseTime : 0}%`}
backgroundColor={ backgroundColor={
check.status check.status
? theme.label.up.dotColor ? theme.palette.success.main
: theme.label.down.dotColor : theme.palette.error.text
} }
sx={{ sx={{
borderRadius: "3px", borderRadius: theme.spacing(1.5),
transition: "height 600ms cubic-bezier(0.4, 0, 0.2, 1)", transition: "height 600ms cubic-bezier(0.4, 0, 0.2, 1)",
}} }}
/> />
@@ -1,17 +1,20 @@
import { BarChart, Bar, Cell, ReferenceLine, Label } from "recharts"; import { BarChart, Bar, Cell, ReferenceLine, Label } from "recharts";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useTheme } from "@emotion/react";
const MonitorDetails60MinChart = ({ data }) => { const MonitorDetails60MinChart = ({ data }) => {
const theme = useTheme();
const labelStyle = { const labelStyle = {
fontSize: "10px", fontSize: "10px",
fill: "#475467", fill: theme.palette.text.tertiary,
}; };
const color = { const color = {
true: "var(--success-color)", true: theme.palette.success.main,
false: "var(--error-color)", false: theme.palette.error.text,
undefined: "var(--unresolved-color)", undefined: theme.palette.unresolved.main,
}; };
return ( return (
<BarChart <BarChart
@@ -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 PropTypes from "prop-types";
import { AreaChart, Area, XAxis, Tooltip, ResponsiveContainer } from "recharts"; import { AreaChart, Area, XAxis, Tooltip, ResponsiveContainer } from "recharts";
import { Box, Typography } from "@mui/material";
import { useTheme } from "@emotion/react";
import "./index.css"; import "./index.css";
const CustomToolTip = ({ active, payload, label }) => { const CustomToolTip = ({ active, payload, label }) => {
const theme = useTheme();
if (active && payload && payload.length) { if (active && payload && payload.length) {
return ( return (
<div className="area-tooltip"> <Box
<p> 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", { {new Date(label).toLocaleDateString("en-US", {
weekday: "short", // Mon weekday: "short", // Mon
month: "long", // July month: "long", // July
@@ -18,10 +37,18 @@ const CustomToolTip = ({ active, payload, label }) => {
minute: "2-digit", // 15 minute: "2-digit", // 15
hour12: true, // AM/PM format hour12: true, // AM/PM format
})} })}
</p> </Typography>
<p>Response Time (ms): {payload[0].payload.originalResponseTime}</p>{" "} <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 */} {/* Display original value */}
</div> </Box>
); );
} }
return null; return null;
@@ -1,7 +0,0 @@
.chart-container {
display: flex;
justify-content: space-around;
align-items: flex-end;
height: 50px;
width: 300px;
}
@@ -1,10 +1,17 @@
import "./index.css";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { Stack } from "@mui/material";
import { BarChart, Bar, ResponsiveContainer, Cell } from "recharts"; import { BarChart, Bar, ResponsiveContainer, Cell } from "recharts";
import "./index.css";
const ResponseTimeChart = ({ checks = [] }) => { const ResponseTimeChart = ({ checks = [] }) => {
return ( return (
<div className="chart-container"> <Stack
flexDirection="row"
justifyContent="space-around"
alignItems="flex-end"
height="50px"
width="300px"
>
<ResponsiveContainer width="100%" height="100%"> <ResponsiveContainer width="100%" height="100%">
<BarChart <BarChart
width={150} width={150}
@@ -26,7 +33,7 @@ const ResponseTimeChart = ({ checks = [] }) => {
</Bar> </Bar>
</BarChart> </BarChart>
</ResponsiveContainer> </ResponsiveContainer>
</div> </Stack>
); );
}; };
@@ -1,7 +1,7 @@
import TabPanel from "@mui/lab/TabPanel"; import TabPanel from "@mui/lab/TabPanel";
import React, { useState } from "react"; import React, { useState } from "react";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { Box, Divider, Stack, Typography } from "@mui/material"; import { Box, Stack, Typography } from "@mui/material";
import ButtonSpinner from "../../ButtonSpinner"; import ButtonSpinner from "../../ButtonSpinner";
import Field from "../../Inputs/Field"; import Field from "../../Inputs/Field";
import { credentials } from "../../../Validation/validation"; import { credentials } from "../../../Validation/validation";
+1 -1
View File
@@ -22,7 +22,7 @@
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: var(--env-var-radius-1); border-radius: var(--env-var-radius-1);
background-color: var(--env-var-color-8); background-color: var(--primary-bg);
padding: var(--env-var-spacing-1) 0; padding: var(--env-var-spacing-1) 0;
} }
@@ -18,8 +18,10 @@ import { StatusLabel } from "../../../../Components/Label";
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded"; import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded"; import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded";
import { logger } from "../../../../Utils/Logger"; import { logger } from "../../../../Utils/Logger";
import { useTheme } from "@emotion/react";
const PaginationTable = ({ monitorId, dateRange }) => { const PaginationTable = ({ monitorId, dateRange }) => {
const theme = useTheme();
const { authToken } = useSelector((state) => state.auth); const { authToken } = useSelector((state) => state.auth);
const [checks, setChecks] = useState([]); const [checks, setChecks] = useState([]);
const [checksCount, setChecksCount] = useState(0); const [checksCount, setChecksCount] = useState(0);
@@ -78,6 +80,19 @@ const PaginationTable = ({ monitorId, dateRange }) => {
page={paginationController.page + 1} //0-indexed page={paginationController.page + 1} //0-indexed
onChange={handlePageChange} onChange={handlePageChange}
shape="rounded" shape="rounded"
sx={{
backgroundColor: theme.palette.background.main,
border: 1,
borderColor: theme.palette.border.light,
"& button": {
color: theme.palette.text.tertiary,
borderRadius: theme.shape.borderRadius,
},
"& li:first-of-type button, & li:last-of-type button": {
border: 1,
borderColor: theme.palette.border.light,
},
}}
renderItem={(item) => ( renderItem={(item) => (
<PaginationItem <PaginationItem
slots={{ slots={{
@@ -93,6 +108,9 @@ const PaginationTable = ({ monitorId, dateRange }) => {
pointerEvents: "none", pointerEvents: "none",
display: "none", display: "none",
}, },
"&.Mui-selected, &.Mui-selected:hover": {
backgroundColor: theme.palette.background.fill,
},
}} }}
/> />
)} )}
@@ -102,13 +120,29 @@ const PaginationTable = ({ monitorId, dateRange }) => {
return ( return (
<> <>
<TableContainer component={Paper}> <TableContainer
component={Paper}
sx={{
border: `solid 1px ${theme.palette.border.light}`,
borderRadius: theme.shape.borderRadius,
}}
>
<Table> <Table>
<TableHead> <TableHead
sx={{
backgroundColor: theme.palette.background.accent,
}}
>
<TableRow> <TableRow>
<TableCell>Status</TableCell> <TableCell sx={{ color: theme.palette.text.secondary }}>
<TableCell>Date & Time</TableCell> Status
<TableCell>Message</TableCell> </TableCell>
<TableCell sx={{ color: theme.palette.text.secondary }}>
Date & Time
</TableCell>
<TableCell sx={{ color: theme.palette.text.secondary }}>
Message
</TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
+7 -7
View File
@@ -1,6 +1,6 @@
.monitor-details h1.MuiTypography-root { .monitor-details h1.MuiTypography-root {
font-size: var(--env-var-font-size-large-plus); font-size: var(--env-var-font-size-large-plus);
color: var(--env-var-color-1); color: var(--primary-color);
font-weight: 600; font-weight: 600;
} }
.monitor-details h2.MuiTypography-root { .monitor-details h2.MuiTypography-root {
@@ -11,10 +11,10 @@
} }
.monitor-details h2.MuiTypography-root, .monitor-details h2.MuiTypography-root,
.monitor-details h4.MuiTypography-root { .monitor-details h4.MuiTypography-root {
color: var(--env-var-color-5); color: var(--secondary-color);
} }
.monitor-details h6.MuiTypography-root { .monitor-details h6.MuiTypography-root {
color: var(--env-var-color-3); color: var(--theme-main);
} }
.monitor-details button.MuiButtonBase-root, .monitor-details button.MuiButtonBase-root,
.monitor-details h4.MuiTypography-root { .monitor-details h4.MuiTypography-root {
@@ -29,7 +29,7 @@
font-size: var(--env-var-font-size-small-plus); font-size: var(--env-var-font-size-small-plus);
} }
.monitor-details p.MuiTypography-root { .monitor-details p.MuiTypography-root {
color: var(--env-var-color-2); color: var(--secondary-color-light);
} }
.monitor-details .stat-box { .monitor-details .stat-box {
@@ -38,7 +38,7 @@
border: solid 1px; border: solid 1px;
border-radius: var(--env-var-radius-1); border-radius: var(--env-var-radius-1);
padding: var(--env-var-spacing-1) 16px; padding: var(--env-var-spacing-1) 16px;
background-color: var(--env-var-color-8); background-color: var(--primary-bg);
} }
.monitor-details h6.MuiTypography-root { .monitor-details h6.MuiTypography-root {
font-size: var(--env-var-font-size-medium-plus); font-size: var(--env-var-font-size-medium-plus);
@@ -46,10 +46,10 @@
.monitor-details h6.MuiTypography-root span.MuiTypography-root { .monitor-details h6.MuiTypography-root span.MuiTypography-root {
font-style: italic; font-style: italic;
font-size: var(--env-var-font-size-medium); font-size: var(--env-var-font-size-medium);
color: var(--env-var-color-5); color: var(--secondary-color);
opacity: 0.7; opacity: 0.7;
} }
.monitor-details button.MuiButtonBase-root, .monitor-details button.MuiButtonBase-root,
.monitor-details .stat-box { .monitor-details .stat-box {
border-color: var(--env-var-color-16); border-color: var(--border-color);
} }
+6 -8
View File
@@ -309,11 +309,11 @@ const StatusBox = ({ title, value }) => {
position="relative" position="relative"
flex={1} flex={1}
border={1} border={1}
borderColor={theme.palette.otherColors.graishWhite} borderColor={theme.palette.border.light}
borderRadius={`${theme.shape.borderRadius}px`} borderRadius={theme.shape.borderRadius}
backgroundColor={theme.palette.otherColors.white} backgroundColor={theme.palette.background.main}
px={theme.gap.large} px={theme.spacing(12)}
py={theme.gap.ml} py={theme.spacing(8)}
overflow="hidden" overflow="hidden"
sx={{ sx={{
"&:hover": { "&:hover": {
@@ -447,9 +447,7 @@ const Monitors = () => {
title: monitor.name, title: monitor.name,
percentage: 100, percentage: 100,
percentageColor: percentageColor:
monitor.status === true monitor.status === true ? "var(--success-color)" : "var(--error-color)",
? "var(--success-color)"
: "var(--error-color)",
status: monitor.status === true ? "up" : "down", status: monitor.status === true ? "up" : "down",
}; };
+26 -5
View File
@@ -40,15 +40,34 @@ const theme = createTheme({
accent: "#838c99", accent: "#838c99",
}, },
background: { background: {
primary: "#FFFFFF", main: "#FFFFFF",
secondary: "#FCFCFD", alt: "#FCFCFD",
fill: "#F4F4F4", fill: "#F4F4F4",
accent: "#f9fafb", accent: "#f9fafb",
}, },
border: { light: "#eaecf0", dark: "#d0d5dd" }, border: { light: "#eaecf0", dark: "#d0d5dd" },
info: {
text: "#475467",
main: "#475467",
bg: "#ffffff",
light: "#ffffff",
border: "#D0D5DD",
},
success: { main: "#17b26a", light: "#d4f4e1", bg: "#ecfdf3" }, success: { main: "#17b26a", light: "#d4f4e1", bg: "#ecfdf3" },
error: { main: "#f04438", light: "#fbd1d1", bg: "#f9eced" }, error: {
warning: { main: "#fdb022", light: "#fffcf5", bg: "#ffecbc" }, text: "#f04438",
main: "#d32f2f",
light: "#fbd1d1",
bg: "#f9eced",
border: "#f04438",
},
warning: {
text: "#DC6803",
main: "#fdb022",
light: "#fffcf5",
bg: "#ffecbc",
border: "#fec84b",
},
unresolved: { main: "#4e5ba6", light: "#e2eaf7", bg: "#f2f4f7" }, unresolved: { main: "#4e5ba6", light: "#e2eaf7", bg: "#f2f4f7" },
other: {}, other: {},
primary: { primary: {
@@ -77,8 +96,10 @@ const theme = createTheme({
fillGray: otherColorsFillGray, fillGray: otherColorsFillGray,
}, },
}, },
spacing: 2,
components: {},
shape: { shape: {
borderRadius: 4, borderRadius: 2,
borderThick: 2, borderThick: 2,
boxShadow: shadow, boxShadow: shadow,
}, },