Refactored theme common color props and fixed button background delay on theme change

This commit is contained in:
Daniel Cojocea committed 2024-08-31 01:33:33 -04:00
1 parent 313a3af67c
commit ac48378614
18 files changed
+48 -40

No files matched your search

@@ -22,7 +22,7 @@ const CustomToolTip = ({ active, payload, label }) => {
> >
<Typography <Typography
sx={{ sx={{
color: theme.palette.common.main, color: theme.palette.primary.main,
fontSize: 13, fontSize: 13,
}} }}
> >
+3 -3
View File
@@ -38,12 +38,12 @@ const ImageField = ({ id, src, loading, onChange }) => {
border: "dashed", border: "dashed",
borderRadius: theme.shape.borderRadius, borderRadius: theme.shape.borderRadius,
borderColor: isDragging borderColor: isDragging
? theme.palette.common.main ? theme.palette.primary.main
: theme.palette.border.light, : theme.palette.border.light,
borderWidth: "2px", borderWidth: "2px",
transition: "0.2s", transition: "0.2s",
"&:hover": { "&:hover": {
borderColor: theme.palette.common.main, borderColor: theme.palette.primary.main,
backgroundColor: "hsl(215, 87%, 51%, 0.05)", backgroundColor: "hsl(215, 87%, 51%, 0.05)",
}, },
}} }}
@@ -96,7 +96,7 @@ const ImageField = ({ id, src, loading, onChange }) => {
<Typography <Typography
component="span" component="span"
fontSize="inherit" fontSize="inherit"
color={theme.palette.common.main} color={theme.palette.primary.main}
fontWeight={500} fontWeight={500}
> >
Click to upload Click to upload
+2 -2
View File
@@ -28,11 +28,11 @@ const Link = ({ level, label, url }) => {
sx: { sx: {
textDecoration: "underline", textDecoration: "underline",
textDecorationStyle: "dashed", textDecorationStyle: "dashed",
textDecorationColor: theme.palette.common.main, textDecorationColor: theme.palette.primary.main,
textUnderlineOffset: "1px", textUnderlineOffset: "1px",
":hover": { ":hover": {
color: theme.palette.text.tertiary, color: theme.palette.text.tertiary,
textDecorationColor: theme.palette.common.main, textDecorationColor: theme.palette.primary.main,
backgroundColor: theme.palette.background.fill, backgroundColor: theme.palette.background.fill,
}, },
}, },
+1 -1
View File
@@ -154,7 +154,7 @@ function Sidebar() {
color="white" color="white"
sx={{ sx={{
position: "relative", position: "relative",
backgroundColor: theme.palette.common.main, backgroundColor: theme.palette.primary.main,
borderRadius: theme.shape.borderRadius, borderRadius: theme.shape.borderRadius,
userSelect: "none", userSelect: "none",
}} }}
@@ -302,7 +302,7 @@ const ProfilePanel = () => {
label="Update" label="Update"
onClick={openPictureModal} onClick={openPictureModal}
sx={{ sx={{
color: theme.palette.common.main, color: theme.palette.primary.main,
}} }}
/> />
</Stack> </Stack>
+3 -3
View File
@@ -90,7 +90,7 @@ const CheckEmail = () => {
overflow="hidden" overflow="hidden"
sx={{ sx={{
"& h1": { "& h1": {
color: theme.palette.common.main, color: theme.palette.primary.main,
fontWeight: 600, fontWeight: 600,
fontSize: 26, fontSize: 26,
}, },
@@ -164,7 +164,7 @@ const CheckEmail = () => {
component="span" component="span"
onClick={resendToken} onClick={resendToken}
sx={{ sx={{
color: theme.palette.common.main, color: theme.palette.primary.main,
userSelect: "none", userSelect: "none",
pointerEvents: disabled ? "none" : "auto", pointerEvents: disabled ? "none" : "auto",
cursor: disabled ? "default" : "pointer", cursor: disabled ? "default" : "pointer",
@@ -181,7 +181,7 @@ const CheckEmail = () => {
<Typography <Typography
component="span" component="span"
ml={theme.spacing(2)} ml={theme.spacing(2)}
color={theme.palette.common.main} color={theme.palette.primary.main}
onClick={handleNavigate} onClick={handleNavigate}
sx={{ userSelect: "none" }} sx={{ userSelect: "none" }}
> >
+2 -2
View File
@@ -92,7 +92,7 @@ const ForgotPassword = () => {
overflow="hidden" overflow="hidden"
sx={{ sx={{
"& h1": { "& h1": {
color: theme.palette.common.main, color: theme.palette.primary.main,
fontWeight: 600, fontWeight: 600,
fontSize: 24, fontSize: 24,
}, },
@@ -185,7 +185,7 @@ const ForgotPassword = () => {
<Typography display="inline-block">Go back to —</Typography> <Typography display="inline-block">Go back to —</Typography>
<Typography <Typography
component="span" component="span"
color={theme.palette.common.main} color={theme.palette.primary.main}
ml={theme.spacing(2)} ml={theme.spacing(2)}
onClick={handleNavigate} onClick={handleNavigate}
sx={{ userSelect: "none" }} sx={{ userSelect: "none" }}
+4 -4
View File
@@ -269,13 +269,13 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
<Typography <Typography
className="forgot-p" className="forgot-p"
display="inline-block" display="inline-block"
color={theme.palette.common.main} color={theme.palette.primary.main}
> >
Forgot password? Forgot password?
</Typography> </Typography>
<Typography <Typography
component="span" component="span"
color={theme.palette.common.main} color={theme.palette.primary.main}
ml={theme.spacing(2)} ml={theme.spacing(2)}
sx={{ userSelect: "none" }} sx={{ userSelect: "none" }}
onClick={handleNavigate} onClick={handleNavigate}
@@ -419,7 +419,7 @@ const Login = () => {
overflow="hidden" overflow="hidden"
sx={{ sx={{
"& h1": { "& h1": {
color: theme.palette.common.main, color: theme.palette.primary.main,
fontWeight: 600, fontWeight: 600,
fontSize: 30, fontSize: 30,
}, },
@@ -491,7 +491,7 @@ const Login = () => {
</Typography> </Typography>
<Typography <Typography
component="span" component="span"
color={theme.palette.common.main} color={theme.palette.primary.main}
ml={theme.spacing(2)} ml={theme.spacing(2)}
onClick={() => { onClick={() => {
navigate("/register"); navigate("/register");
@@ -27,7 +27,7 @@ const NewPasswordConfirmed = () => {
overflow="hidden" overflow="hidden"
sx={{ sx={{
"& h1": { "& h1": {
color: theme.palette.common.main, color: theme.palette.primary.main,
fontWeight: 600, fontWeight: 600,
fontSize: 22, fontSize: 22,
}, },
@@ -99,7 +99,7 @@ const NewPasswordConfirmed = () => {
<Typography display="inline-block">Go back to —</Typography> <Typography display="inline-block">Go back to —</Typography>
<Typography <Typography
component="span" component="span"
color={theme.palette.common.main} color={theme.palette.primary.main}
ml={theme.spacing(2)} ml={theme.spacing(2)}
onClick={handleNavigate} onClick={handleNavigate}
sx={{ userSelect: "none" }} sx={{ userSelect: "none" }}
+2 -2
View File
@@ -644,7 +644,7 @@ const Register = ({ isSuperAdmin }) => {
overflow="hidden" overflow="hidden"
sx={{ sx={{
"& h1": { "& h1": {
color: theme.palette.common.main, color: theme.palette.primary.main,
fontWeight: 600, fontWeight: 600,
fontSize: 30, fontSize: 30,
}, },
@@ -731,7 +731,7 @@ const Register = ({ isSuperAdmin }) => {
onClick={() => { onClick={() => {
navigate("/login"); navigate("/login");
}} }}
sx={{ userSelect: "none", color: theme.palette.common.main }} sx={{ userSelect: "none", color: theme.palette.primary.main }}
> >
Log In Log In
</Typography> </Typography>
+2 -2
View File
@@ -109,7 +109,7 @@ const SetNewPassword = () => {
overflow="hidden" overflow="hidden"
sx={{ sx={{
"& h1": { "& h1": {
color: theme.palette.common.main, color: theme.palette.primary.main,
fontWeight: 600, fontWeight: 600,
fontSize: 24, fontSize: 24,
}, },
@@ -280,7 +280,7 @@ const SetNewPassword = () => {
<Typography display="inline-block">Go back to —</Typography> <Typography display="inline-block">Go back to —</Typography>
<Typography <Typography
component="span" component="span"
color={theme.palette.common.main} color={theme.palette.primary.main}
ml={theme.spacing(2)} ml={theme.spacing(2)}
onClick={() => navigate("/login")} onClick={() => navigate("/login")}
sx={{ userSelect: "none" }} sx={{ userSelect: "none" }}
@@ -215,7 +215,7 @@ const CreateNewMaintenanceWindow = () => {
sx={{ sx={{
width: "fit-content", width: "fit-content",
fontSize: "var(--env-var-font-size-small)", fontSize: "var(--env-var-font-size-small)",
borderBottom: `1px dashed ${theme.palette.common.main}`, borderBottom: `1px dashed ${theme.palette.primary.main}`,
paddingBottom: "4px", paddingBottom: "4px",
}} }}
> >
+1 -1
View File
@@ -37,7 +37,7 @@ const StatBox = ({ title, value }) => {
mb={theme.spacing(2)} mb={theme.spacing(2)}
fontSize={14} fontSize={14}
fontWeight={500} fontWeight={500}
color={theme.palette.common.main} color={theme.palette.primary.main}
sx={{ sx={{
"& span": { "& span": {
color: theme.palette.text.accent, color: theme.palette.text.accent,
+1 -1
View File
@@ -77,7 +77,7 @@ const Monitors = ({ isAdmin }) => {
{monitorState.monitors?.length !== 0 && ( {monitorState.monitors?.length !== 0 && (
<Button <Button
variant="contained" variant="contained"
color="common" color="primary"
onClick={() => { onClick={() => {
navigate("/monitors/create"); navigate("/monitors/create");
}} }}
+3 -3
View File
@@ -43,7 +43,7 @@ const StatBox = ({ icon, title, value }) => {
<Box> <Box>
<Typography <Typography
variant="h6" variant="h6"
color={theme.palette.common.main} color={theme.palette.primary.main}
mb={theme.spacing(6)} mb={theme.spacing(6)}
> >
{title} {title}
@@ -592,7 +592,7 @@ const PageSpeedDetails = () => {
<Typography <Typography
component="span" component="span"
sx={{ sx={{
color: theme.palette.common.main, color: theme.palette.primary.main,
fontWeight: 500, fontWeight: 500,
textDecoration: "underline", textDecoration: "underline",
cursor: "pointer", cursor: "pointer",
@@ -627,7 +627,7 @@ const PageSpeedDetails = () => {
<Typography <Typography
component="span" component="span"
sx={{ sx={{
color: theme.palette.common.main, color: theme.palette.primary.main,
fontWeight: 500, fontWeight: 500,
textDecoration: "underline", textDecoration: "underline",
cursor: "pointer", cursor: "pointer",
+1 -1
View File
@@ -52,7 +52,7 @@ const Card = ({ data }) => {
<Typography <Typography
component="h2" component="h2"
mb={theme.spacing(2)} mb={theme.spacing(2)}
color={theme.palette.common.main} color={theme.palette.primary.main}
> >
{data.name} {data.name}
</Typography> </Typography>
+9 -5
View File
@@ -14,7 +14,6 @@ const background = {
accent: "#18181a", accent: "#18181a",
}; };
const border = { light: "#27272a", dark: "#2c2c2c" }; const border = { light: "#27272a", dark: "#2c2c2c" };
const common = { main: "#1570ef", dark: "#0e4ea7", contrastText: "#FFFFFF" };
const fontFamilyDefault = const fontFamilyDefault =
'"Inter","system-ui", "Avenir", "Helvetica", "Arial", sans-serif'; '"Inter","system-ui", "Avenir", "Helvetica", "Arial", sans-serif';
@@ -25,7 +24,7 @@ const darkTheme = createTheme({
typography: { fontFamily: fontFamilyDefault, fontSize: 13 }, typography: { fontFamily: fontFamilyDefault, fontSize: 13 },
palette: { palette: {
mode: "dark", mode: "dark",
common: common, primary: { main: "#1570ef" },
text: text, text: text,
background: background, background: background,
border: border, border: border,
@@ -66,9 +65,6 @@ const darkTheme = createTheme({
grid: "#454546", grid: "#454546",
}, },
// TO BE REMOVED // // TO BE REMOVED //
primary: {
main: "#1570ef",
},
secondary: { secondary: {
main: "#e6e6e6", main: "#e6e6e6",
}, },
@@ -103,6 +99,7 @@ const darkTheme = createTheme({
styleOverrides: { styleOverrides: {
root: { root: {
padding: 4, padding: 4,
transition: "none",
"&:hover": { "&:hover": {
backgroundColor: background.fill, backgroundColor: background.fill,
}, },
@@ -131,6 +128,13 @@ const darkTheme = createTheme({
}, },
}, },
}, },
MuiListItemButton: {
styleOverrides: {
root: {
transition: "none",
},
},
},
MuiMenuItem: { MuiMenuItem: {
styleOverrides: { styleOverrides: {
root: { root: {
+9 -5
View File
@@ -13,7 +13,6 @@ const background = {
accent: "#f9fafb", accent: "#f9fafb",
}; };
const border = { light: "#eaecf0", dark: "#d0d5dd" }; const border = { light: "#eaecf0", dark: "#d0d5dd" };
const common = { main: "#1570ef", dark: "#0e4ea7", contrastText: "#FFFFFF" };
const fontFamilyDefault = const fontFamilyDefault =
'"Inter","system-ui", "Avenir", "Helvetica", "Arial", sans-serif'; '"Inter","system-ui", "Avenir", "Helvetica", "Arial", sans-serif';
@@ -23,7 +22,7 @@ const shadow =
const lightTheme = createTheme({ const lightTheme = createTheme({
typography: { fontFamily: fontFamilyDefault, fontSize: 13 }, typography: { fontFamily: fontFamilyDefault, fontSize: 13 },
palette: { palette: {
common: common, primary: { main: "#1570EF" },
text: text, text: text,
background: background, background: background,
border: border, border: border,
@@ -63,9 +62,6 @@ const lightTheme = createTheme({
grid: "#a2a3a3", grid: "#a2a3a3",
}, },
// TO BE REMOVED // // TO BE REMOVED //
primary: {
main: "#1570EF",
},
secondary: { secondary: {
main: "#475467", main: "#475467",
}, },
@@ -100,6 +96,7 @@ const lightTheme = createTheme({
styleOverrides: { styleOverrides: {
root: { root: {
padding: 4, padding: 4,
transition: "none",
"&:hover": { "&:hover": {
backgroundColor: background.fill, backgroundColor: background.fill,
}, },
@@ -126,6 +123,13 @@ const lightTheme = createTheme({
}, },
}, },
}, },
MuiListItemButton: {
styleOverrides: {
root: {
transition: "none",
},
},
},
MuiMenuItem: { MuiMenuItem: {
styleOverrides: { styleOverrides: {
root: { root: {