diff --git a/Client/src/Components/Alert/index.css b/Client/src/Components/Alert/index.css new file mode 100644 index 000000000..9f0c397e3 --- /dev/null +++ b/Client/src/Components/Alert/index.css @@ -0,0 +1,9 @@ +.alert { + margin: 0; + width: fit-content; + padding: var(--env-var-spacing-1-plus); + font-size: var(--env-var-font-size-medium); +} +.alert .MuiStack-root { + max-width: 85%; +} diff --git a/Client/src/Components/Alert/index.jsx b/Client/src/Components/Alert/index.jsx new file mode 100644 index 000000000..bf2531bba --- /dev/null +++ b/Client/src/Components/Alert/index.jsx @@ -0,0 +1,60 @@ +import PropTypes from "prop-types"; +import { useTheme } from "@emotion/react"; +import { Box, Stack } from "@mui/material"; +import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined"; +import ErrorOutlineOutlinedIcon from "@mui/icons-material/ErrorOutlineOutlined"; +import WarningAmberOutlinedIcon from "@mui/icons-material/WarningAmberOutlined"; +import "./index.css"; + +/** + * Icons mapping for different alert variants. + * @type {Object} + */ + +const icons = { + info: , + error: , + warning: , +}; + +/** + * @param {Object} props + * @param {'info' | 'error' | 'warning'} props.variant - The type of alert. + * @param {string} [props.title] - The title of the alert. + * @param {string} [props.body] - The body text of the alert. + * @returns {JSX.Element} + */ + +const Alert = ({ variant, title, body }) => { + const theme = useTheme(); + const { bg, border, color } = theme.alert[variant]; + const icon = icons[variant]; + + return ( + + {icon && {icon}} + + {title && {title}} + {body && {body}} + + + ); +}; + +Alert.propTypes = { + variant: PropTypes.oneOf(["info", "error", "warning"]).isRequired, + title: PropTypes.string, + body: PropTypes.string, +}; + +export default Alert; diff --git a/Client/src/Components/TabPanels/Account/PasswordPanel.jsx b/Client/src/Components/TabPanels/Account/PasswordPanel.jsx index 1e04ecaea..ebd0743e8 100644 --- a/Client/src/Components/TabPanels/Account/PasswordPanel.jsx +++ b/Client/src/Components/TabPanels/Account/PasswordPanel.jsx @@ -1,14 +1,11 @@ import TabPanel from "@mui/lab/TabPanel"; import React, { useState } from "react"; -// import AnnouncementsDualButtonWithIcon from "../../Announcements/AnnouncementsDualButtonWithIcon/AnnouncementsDualButtonWithIcon"; -import AnnouncementsDualButtonWithIcon from "../../Toast/AnnouncementsDualButtonWithIcon/AnnouncementsDualButtonWithIcon"; import { useTheme } from "@emotion/react"; import { Box, Divider, Stack, Typography } from "@mui/material"; -import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined"; -import WarningAmberOutlinedIcon from "@mui/icons-material/WarningAmberOutlined"; import ButtonSpinner from "../../ButtonSpinner"; import PasswordTextField from "../../TextFields/Password/PasswordTextField"; import { editPasswordValidation } from "../../../Validation/validation"; +import Alert from "../../Alert"; /** * PasswordPanel component manages the form for editing password. @@ -96,13 +93,9 @@ const PasswordPanel = () => { spellCheck="false" >
- - } - subject="SSO login" +
@@ -181,8 +174,8 @@ const PasswordPanel = () => {
- } + diff --git a/Client/src/Pages/Account/index.css b/Client/src/Pages/Account/index.css index 212292d9b..d85ada5a7 100644 --- a/Client/src/Pages/Account/index.css +++ b/Client/src/Pages/Account/index.css @@ -28,8 +28,7 @@ margin: 50px 0; } .account .MuiDivider-root, -.account .MuiOutlinedInput-root fieldset, -.account .announcement-tile { +.account .MuiOutlinedInput-root fieldset { border-color: var(--env-var-color-29); } .account [class$="-form"] { @@ -42,9 +41,9 @@ justify-content: space-between; align-items: flex-start; } -.edit-profile-form__wrapper .MuiStack-root:not(.row-stack), -.edit-password-form__wrapper .MuiStack-root:not(.row-stack), -.edit-organization-form__wrapper .MuiStack-root:not(.row-stack) { +.edit-profile-form__wrapper>.MuiStack-root:not(.row-stack), +.edit-password-form__wrapper>.MuiStack-root:not(.row-stack), +.edit-organization-form__wrapper>.MuiStack-root:not(.row-stack) { flex-direction: column; gap: 8px; margin-right: 10px; @@ -74,36 +73,13 @@ #input-team-member { padding: 10px; } -.edit-password-form__wrapper > .announcement-tile { - width: 100%; -} -.edit-password-form__wrapper - > .announcement-tile - .announcement-content-subject { - margin-bottom: 2px; -} #edit-new-password + div > button > svg, #edit-confirm-password + div > button > svg, #edit-current-password + div > button > svg { color: var(--env-var-color-29); } -.edit-password-form__wrapper .announcement-tile { - margin: 0; -} -.edit-password-form__wrapper .announcement-tile .announcement-close { - margin-left: auto; -} -.MuiBox-root > .announcement-tile { - border-color: var(--env-var-color-27); - background-color: var(--lighter-env-var-color-27); -} -.MuiBox-root > .announcement-tile .announcement-content-body { - color: var(--env-var-color-28); -} -.MuiBox-root > .announcement-tile .announcement-close svg, -.edit-password-form__wrapper > .announcement-tile .announcement-close svg { - display: none; -} + + #org-name-flex-container .Mui-disabled { color: var(--env-var-color-2) !important; } diff --git a/Client/src/Pages/Demo/Demo.jsx b/Client/src/Pages/Demo/Demo.jsx index 552c65ad2..42e30b6d2 100644 --- a/Client/src/Pages/Demo/Demo.jsx +++ b/Client/src/Pages/Demo/Demo.jsx @@ -15,6 +15,7 @@ import { Tabs, Typography, Stack, + Box, } from "@mui/material"; import { ColoredLabel, StatusLabel } from "../../Components/Label/"; import Avatar from "../../Components/Avatar/"; @@ -29,7 +30,7 @@ import AddIcon from "@mui/icons-material/Add"; import Divider from "@mui/material/Divider"; import UploadIcon from "@mui/icons-material/Upload"; import SendIcon from "@mui/icons-material/Send"; -import ImageIcon from '@mui/icons-material/Image'; +import ImageIcon from "@mui/icons-material/Image"; // Redux import { useSelector } from "react-redux"; @@ -38,6 +39,7 @@ import { getMonitors } from "../../Features/Monitors/monitorsSlice"; import { getMonitorsByUserId } from "../../Features/Monitors/monitorsSlice"; import ImageField from "../../Components/TextFields/Image"; import ProgressUpload from "../../Components/ProgressBars"; +import Alert from "../../Components/Alert"; const cols = [ { @@ -423,7 +425,30 @@ const Demo = () => { - } label="image.jpg" size="2 MB"/> + } label="image.jpg" size="2 MB" /> + + + + + + + + + + + +
diff --git a/Client/src/Utils/Theme.js b/Client/src/Utils/Theme.js index c9f20126f..60273cd95 100644 --- a/Client/src/Utils/Theme.js +++ b/Client/src/Utils/Theme.js @@ -88,14 +88,32 @@ const theme = createTheme({ }, content: { pX: "80px", - pY: "40px" + pY: "40px", }, gap: { small: "8px", medium: "12px", + ml: "16px", large: "24px", - xl: "40px" - } + xl: "40px", + }, + alert: { + info: { + color: secondaryMain, + bg: otherColorsWhite, + border: "#d0d5dd", + }, + error: { + color: "#d92d20", + bg: "hsla(0, 100%, 52%, 0.03)", + border: "#f04438", + }, + warning: { + color: "#f79009", + bg: "#fffaef", + border: "#fecf60" + }, + }, }); export default theme;