From cedbcd7141d2022310f381e13be7578e82efe3d2 Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Sat, 31 Aug 2024 14:53:15 -0400 Subject: [PATCH] Refactored button group styling --- .../TabPanels/Account/TeamPanel.jsx | 63 ++++++--------- Client/src/Pages/Monitors/Configure/index.jsx | 15 ++-- .../Pages/Monitors/CreateMonitor/index.jsx | 42 ++++------ Client/src/Pages/Monitors/Details/index.jsx | 77 ++++++++----------- Client/src/Pages/PageSpeed/index.jsx | 11 +-- Client/src/Utils/Theme/darkTheme.js | 30 ++++++-- Client/src/Utils/Theme/lightTheme.js | 30 ++++++-- 7 files changed, 135 insertions(+), 133 deletions(-) diff --git a/Client/src/Components/TabPanels/Account/TeamPanel.jsx b/Client/src/Components/TabPanels/Account/TeamPanel.jsx index 9c63bd1c2..97235049e 100644 --- a/Client/src/Components/TabPanels/Account/TeamPanel.jsx +++ b/Client/src/Components/TabPanels/Account/TeamPanel.jsx @@ -2,6 +2,7 @@ import { useTheme } from "@emotion/react"; import TabPanel from "@mui/lab/TabPanel"; import { Box, + Button, ButtonGroup, Divider, IconButton, @@ -11,7 +12,6 @@ import { Typography, } from "@mui/material"; import ButtonSpinner from "../../ButtonSpinner"; -import Button from "../../Button"; import { useEffect, useState } from "react"; import EditSvg from "../../../assets/icons/edit.svg?react"; import Field from "../../Inputs/Field"; @@ -283,48 +283,37 @@ const TeamPanel = () => { gap={theme.spacing(6)} sx={{ fontSize: 14 }} > - + { mt={theme.spacing(8)} justifyContent="flex-end" > - { justifyContent="flex-end" > + diff --git a/Client/src/Pages/Monitors/CreateMonitor/index.jsx b/Client/src/Pages/Monitors/CreateMonitor/index.jsx index bc0f55ed3..5147236e2 100644 --- a/Client/src/Pages/Monitors/CreateMonitor/index.jsx +++ b/Client/src/Pages/Monitors/CreateMonitor/index.jsx @@ -1,5 +1,5 @@ import { useState } from "react"; -import { Box, ButtonGroup, Stack, Typography } from "@mui/material"; +import { Box, Button, ButtonGroup, Stack, Typography } from "@mui/material"; import { useSelector, useDispatch } from "react-redux"; import { monitorValidation } from "../../../Validation/validation"; import { createUptimeMonitor } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice"; @@ -9,7 +9,6 @@ import { createToast } from "../../../Utils/toastUtils"; import { logger } from "../../../Utils/Logger"; import { ConfigBox } from "../styled"; import Radio from "../../../Components/Inputs/Radio"; -import Button from "../../../Components/Button"; import Field from "../../../Components/Inputs/Field"; import Select from "../../../Components/Inputs/Select"; import Checkbox from "../../../Components/Inputs/Checkbox"; @@ -232,29 +231,19 @@ const CreateMonitor = () => { {monitor.type === "http" ? ( ) : ( "" @@ -354,12 +343,13 @@ const CreateMonitor = () => { diff --git a/Client/src/Pages/Monitors/Details/index.jsx b/Client/src/Pages/Monitors/Details/index.jsx index 02fb769bf..616f18657 100644 --- a/Client/src/Pages/Monitors/Details/index.jsx +++ b/Client/src/Pages/Monitors/Details/index.jsx @@ -1,6 +1,13 @@ import PropTypes from "prop-types"; import { useEffect, useState, useCallback } from "react"; -import { Box, Skeleton, Stack, Typography, useTheme } from "@mui/material"; +import { + Box, + Button, + Skeleton, + Stack, + Typography, + useTheme, +} from "@mui/material"; import { useSelector } from "react-redux"; import { useNavigate, useParams } from "react-router-dom"; import { networkService } from "../../../main"; @@ -11,7 +18,6 @@ import { } from "../../../Utils/timeUtils"; import MonitorDetailsAreaChart from "../../../Components/Charts/MonitorDetailsAreaChart"; import ButtonGroup from "@mui/material/ButtonGroup"; -import Button from "../../../Components/Button"; import SettingsIcon from "../../../assets/icons/settings-bold.svg?react"; import PaginationTable from "./PaginationTable"; import Breadcrumbs from "../../../Components/Breadcrumbs"; @@ -237,28 +243,23 @@ const DetailsPage = ({ isAdmin }) => { {isAdmin && ( )} { > Response Times - + { > diff --git a/Client/src/Utils/Theme/darkTheme.js b/Client/src/Utils/Theme/darkTheme.js index 05c5942d9..61d37fcab 100644 --- a/Client/src/Utils/Theme/darkTheme.js +++ b/Client/src/Utils/Theme/darkTheme.js @@ -25,12 +25,13 @@ const darkTheme = createTheme({ palette: { mode: "dark", primary: { main: "#1570ef" }, + secondary: { main: "#2e2e2e" }, text: text, background: background, border: border, info: { text: text.primary, - main: text.primary, + main: text.secondary, bg: background.main, light: background.main, border: border.light, @@ -65,9 +66,6 @@ const darkTheme = createTheme({ grid: "#454546", }, // TO BE REMOVED // - secondary: { - main: "#e6e6e6", - }, tertiary: { main: "#e6e6e6", }, @@ -80,8 +78,26 @@ const darkTheme = createTheme({ disableRipple: true, }, styleOverrides: { - root: { - variants: [], + root: ({ theme }) => ({ + variants: [ + { + props: (props) => props.variant === "group", + style: { + color: theme.palette.secondary.contrastText, + backgroundColor: theme.palette.background.main, + border: 1, + borderStyle: "solid", + borderColor: theme.palette.border.light, + }, + }, + { + props: (props) => + props.variant === "group" && props.filled === "true", + style: { + backgroundColor: theme.palette.secondary.main, + }, + }, + ], fontWeight: 400, borderRadius: 4, boxShadow: "none", @@ -92,7 +108,7 @@ const darkTheme = createTheme({ "&:hover": { boxShadow: "none", }, - }, + }), }, }, MuiIconButton: { diff --git a/Client/src/Utils/Theme/lightTheme.js b/Client/src/Utils/Theme/lightTheme.js index 1610ec322..92481a4df 100644 --- a/Client/src/Utils/Theme/lightTheme.js +++ b/Client/src/Utils/Theme/lightTheme.js @@ -23,12 +23,13 @@ const lightTheme = createTheme({ typography: { fontFamily: fontFamilyDefault, fontSize: 13 }, palette: { primary: { main: "#1570EF" }, + secondary: { main: "#F4F4F4", dark: "#e3e3e3", contrastText: "#475467" }, text: text, background: background, border: border, info: { text: text.primary, - main: text.primary, + main: text.secondary, bg: background.main, light: background.main, border: border.dark, @@ -62,9 +63,6 @@ const lightTheme = createTheme({ grid: "#a2a3a3", }, // TO BE REMOVED // - secondary: { - main: "#475467", - }, tertiary: { main: "#475467", }, @@ -77,8 +75,26 @@ const lightTheme = createTheme({ disableRipple: true, }, styleOverrides: { - root: { - variants: [], + root: ({ theme }) => ({ + variants: [ + { + props: (props) => props.variant === "group", + style: { + color: theme.palette.secondary.contrastText, + backgroundColor: theme.palette.background.main, + border: 1, + borderStyle: "solid", + borderColor: theme.palette.border.light, + }, + }, + { + props: (props) => + props.variant === "group" && props.filled === "true", + style: { + backgroundColor: theme.palette.secondary.main, + }, + }, + ], fontWeight: 400, borderRadius: 4, boxShadow: "none", @@ -89,7 +105,7 @@ const lightTheme = createTheme({ "&:hover": { boxShadow: "none", }, - }, + }), }, }, MuiIconButton: {