UNPKG

@gravity-ui/uikit

Version:

Gravity UI base styling and components

48 lines (47 loc) 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AlertIcon = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const icons_1 = require("@gravity-ui/icons"); const Icon_1 = require("../Icon/index.js"); const colorText_1 = require("../Text/colorText/colorText.js"); const constants_1 = require("./constants.js"); const typeToIcon = { danger: { filled: icons_1.CircleXmarkFill, outlined: icons_1.CircleXmark, }, info: { filled: icons_1.CircleInfoFill, outlined: icons_1.CircleInfo, }, success: { filled: icons_1.CircleCheckFill, outlined: icons_1.CircleCheck, }, warning: { filled: icons_1.TriangleExclamationFill, outlined: icons_1.TriangleExclamation, }, utility: { filled: icons_1.ThunderboltFill, outlined: icons_1.Thunderbolt, }, normal: null, }; const AlertIcon = ({ className, theme, view = 'filled', size = constants_1.DEFAULT_ICON_SIZE, }) => { const iconByTheme = typeToIcon[theme]; if (!iconByTheme) { return null; } let color; if (theme === 'success') { color = 'positive'; } else if (theme !== 'normal') { color = theme; } return ((0, jsx_runtime_1.jsx)("div", { className: (0, constants_1.bAlert)('icon', (0, colorText_1.colorText)({ color }, className)), children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { data: iconByTheme[view], size: size }) })); }; exports.AlertIcon = AlertIcon; //# sourceMappingURL=AlertIcon.js.map