usage warning color

This commit is contained in:
mohadeseh safari committed 2025-04-07 15:06:42 -04:00
1 parent 623a2b65b9
commit b3599361e8
3 files changed
+19 -45

No files matched your search

+3 -12
View File
@@ -26,9 +26,6 @@ const icons = {
* @param {boolean} [props.isToast] - Indicates if the alert is used as a toast notification. * @param {boolean} [props.isToast] - Indicates if the alert is used as a toast notification.
* @param {boolean} [props.hasIcon] - Whether to display an icon in the alert. * @param {boolean} [props.hasIcon] - Whether to display an icon in the alert.
* @param {function} props.onClick - Toast dismiss function. * @param {function} props.onClick - Toast dismiss function.
* @param {string} [props.customBgColor] - Custom background color for the alert.
* @param {string} [props.customTextColor] - Custom text color for the alert.
* @param {string} [props.customBorderColor] - Custom border color for the alert.
* @returns {JSX.Element} * @returns {JSX.Element}
*/ */
@@ -39,9 +36,6 @@ const Alert = ({
isToast, isToast,
hasIcon = true, hasIcon = true,
onClick, onClick,
customBgColor,
customTextColor,
customBorderColor
}) => { }) => {
const theme = useTheme(); const theme = useTheme();
/* TODO /* TODO
@@ -49,9 +43,9 @@ const Alert = ({
*/ */
// Use custom colors if provided, otherwise use theme colors // Use custom colors if provided, otherwise use theme colors
const text = customTextColor || theme.palette.secondary.contrastText; const text = theme.palette.secondary.contrastText;
const border = customBorderColor || theme.palette.alert.contrastText; const border = theme.palette.alert.contrastText;
const bg = customBgColor || theme.palette.alert.main; const bg = theme.palette.alert.main;
const icon = icons[variant]; const icon = icons[variant];
return ( return (
@@ -128,9 +122,6 @@ Alert.propTypes = {
body: PropTypes.string, body: PropTypes.string,
isToast: PropTypes.bool, isToast: PropTypes.bool,
hasIcon: PropTypes.bool, hasIcon: PropTypes.bool,
customBgColor: PropTypes.string,
customTextColor: PropTypes.string,
customBorderColor: PropTypes.string,
onClick: function (props, propName, componentName) { onClick: function (props, propName, componentName) {
if (props.isToast && !props[propName]) { if (props.isToast && !props[propName]) {
return new Error( return new Error(
+13 -16
View File
@@ -7,7 +7,6 @@ import Background from "../../assets/Images/background-grid.svg?react";
import Check from "../Check/Check"; import Check from "../Check/Check";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { paletteColors } from "../../Utils/Theme/constants";
import Alert from "../Alert"; import Alert from "../Alert";
import "./index.css"; import "./index.css";
@@ -118,26 +117,24 @@ const Fallback = ({ title, checks, link = "/", isAdmin, vowelStart = false }) =>
{/* Warning box for PageSpeed monitor */} {/* Warning box for PageSpeed monitor */}
{title === "pagespeed monitor" && ( {title === "pagespeed monitor" && (
<Box sx={{ width: "80%", maxWidth: "600px", zIndex: 1 }}> <Box sx={{ width: "80%", maxWidth: "600px", zIndex: 1 }}>
<style> <Box sx={{
{` '& .alert.row-stack': {
/* Only apply custom icon color in light mode */ backgroundColor: theme.palette.warning.main,
${mode === 'light' ? ` borderColor: theme.palette.warning.lowContrast,
.pagespeed-warning .alert.row-stack > .MuiBox-root > svg { '& .MuiTypography-root': {
color: ${paletteColors.orange600} !important; color: theme.palette.warning.contrastText
} },
` : ''} '& .MuiBox-root > svg': {
`} color: theme.palette.warning.contrastText
</style> }
<div className="pagespeed-warning"> }
}}>
<Alert <Alert
variant="warning" variant="warning"
hasIcon={true} hasIcon={true}
body={renderWarningMessage()} body={renderWarningMessage()}
customTextColor={mode === 'light' ? paletteColors.orange600 : undefined}
customBgColor={mode === 'light' ? paletteColors.yellow50 : undefined}
customBorderColor={mode === 'light' ? paletteColors.yellow300 : undefined}
/> />
</div> </Box>
</Box> </Box>
)} )}
</> </>
+3 -17
View File
@@ -63,8 +63,7 @@ const paletteColors = {
orange500: "#E88C30", orange500: "#E88C30",
orange600: "#DC6803", orange600: "#DC6803",
orange800: "#624711", orange800: "#624711",
yellow50: "#FFFCF5",
yellow300: "#FEC84B",
}; };
const semanticColors = { const semanticColors = {
@@ -250,20 +249,7 @@ const newSemanticColors = {
dark: newColors.red600, dark: newColors.red600,
}, },
}, },
pageSpeedWarning: {
main: {
light: newColors.yellow50,
dark: newColors.yellow300,
},
contrastText: {
light: newColors.offBlack,
dark: newColors.offWhite,
},
lowContrast: {
light: newColors.yellow300,
dark: newColors.yellow50,
},
},
/* These are temporary, just for everything not to break */ /* These are temporary, just for everything not to break */
gradient: { gradient: {
color1: { color1: {
@@ -324,4 +310,4 @@ const newSemanticColors = {
}, },
}; };
export { typographyLevels, semanticColors as colors, newSemanticColors, paletteColors }; export { typographyLevels, semanticColors as colors, newSemanticColors };