infinity-forge
Version:
51 lines • 3.53 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.DetailCard = DetailCard;
var jsx_runtime_1 = require("react/jsx-runtime");
var highlight_icon_1 = require("../highlight-icon/index.js");
var ui_1 = require("../../../../ui/index.js");
var S = __importStar(require("./styles.js"));
function DetailCard(_a) {
var icon = _a.icon, color = _a.color, title = _a.title, subTitle = _a.subTitle, action = _a.action, warning = _a.warning, iconSize = _a.iconSize, highlight = _a.highlight;
if (!title) {
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
}
return ((0, jsx_runtime_1.jsx)(ui_1.Error, { name: 'DetailCard', children: (0, jsx_runtime_1.jsxs)(S.DetailCard, { style: { color: color, borderColor: warning ? color : '#e1e1e1' }, className: highlight ? 'highlight' : '', children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(highlight_icon_1.HighlightIcon, { icon: {
name: icon,
size: iconSize || 'regular',
}, color: color }), (0, jsx_runtime_1.jsxs)("div", { className: 'content', children: [title && (0, jsx_runtime_1.jsx)("span", { className: 'font-18-bold detail-title', children: title }), subTitle && (0, jsx_runtime_1.jsx)("span", { className: 'font-16-regular detail-subtitle', children: subTitle })] })] }), !action && warning && ((0, jsx_runtime_1.jsx)(ui_1.Tooltip, { idTooltip: 'DetailCard', enableHover: true, bgColor: '#fff', content: warning === null || warning === void 0 ? void 0 : warning.message, trigger: (0, jsx_runtime_1.jsx)("div", { className: 'icon', children: (0, jsx_runtime_1.jsx)(ui_1.Icon, { name: 'IconExclamation', color: '#E02F2F' }) }) })), (action === null || action === void 0 ? void 0 : action.type) && !warning && ((0, jsx_runtime_1.jsx)("div", { className: 'action-box', children: (0, jsx_runtime_1.jsx)("button", { className: 'action-button', type: 'button', onClick: action === null || action === void 0 ? void 0 : action.onClick, children: (0, jsx_runtime_1.jsx)(ui_1.Icon, { name: action.type }) }) }))] }) }));
}
//# sourceMappingURL=component.js.map