@pagopa/mui-italia
Version:
[Material-UI](https://mui.com/core/) theme inspired by [Bootstrap Italia](https://italia.github.io/bootstrap-italia/).
21 lines (20 loc) • 1.37 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getColor = exports.getIcon = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const InfoRounded_1 = tslib_1.__importDefault(require("@mui/icons-material/InfoRounded"));
const ReportRounded_1 = tslib_1.__importDefault(require("@mui/icons-material/ReportRounded"));
const WarningRounded_1 = tslib_1.__importDefault(require("@mui/icons-material/WarningRounded"));
const CheckCircleRounded_1 = tslib_1.__importDefault(require("@mui/icons-material/CheckCircleRounded"));
const iconSize = '24px';
const iconBySeverity = {
info: (0, jsx_runtime_1.jsx)(InfoRounded_1.default, { sx: { width: iconSize, height: iconSize } }),
error: (0, jsx_runtime_1.jsx)(ReportRounded_1.default, { sx: { width: iconSize, height: iconSize } }),
warning: (0, jsx_runtime_1.jsx)(WarningRounded_1.default, { sx: { width: iconSize, height: iconSize } }),
success: (0, jsx_runtime_1.jsx)(CheckCircleRounded_1.default, { sx: { width: iconSize, height: iconSize } }),
};
const getIcon = (severity) => severity !== undefined ? iconBySeverity[severity] : iconBySeverity.success;
exports.getIcon = getIcon;
const getColor = (theme, severity) => severity !== undefined ? theme.palette[severity][850] : theme.palette.success[850];
exports.getColor = getColor;