nexpi-ui
Version:
An elegant and minimalist Next.js 14 component library
39 lines • 1.57 kB
JavaScript
import { __assign, __rest } from "tslib";
import styles from './styles/WarningBox.module.css';
import { FaRegBell, FaRegQuestionCircle, FaRegCheckCircle, FaExclamationTriangle, FaRegTimesCircle } from 'react-icons/fa';
import React from 'react';
var selectColor = function (variant) {
switch (variant) {
case 'notice':
return 'var(--nxp-cian)';
case 'info':
return 'var(--nxp-light-violet)';
case 'success':
return 'var(--nxp-light-green)';
case 'warning':
return 'var(--nxp-yellow)';
case 'error':
return 'var(--nxp-light-red)';
default:
return 'var(--nxp-cian)';
}
};
var iconMap = {
notice: React.createElement(FaRegBell, { size: 30 }),
info: React.createElement(FaRegQuestionCircle, { size: 30 }),
success: React.createElement(FaRegCheckCircle, { size: 30 }),
warning: React.createElement(FaExclamationTriangle, { size: 30 }),
error: React.createElement(FaRegTimesCircle, { size: 30 }),
};
var WarningBox = function (_a) {
var props = __rest(_a, []);
if (!props.variant) {
props.variant = 'notice';
}
var Icon = iconMap[props.variant];
return React.createElement("div", __assign({ className: styles.card, style: { backgroundColor: selectColor(props.variant) } }, props),
React.createElement("div", { style: { display: 'flex', justifyContent: 'center', marginBottom: '1.2rem' } }, Icon),
props.children);
};
export default WarningBox;
//# sourceMappingURL=WarningBox.js.map