brightyui
Version:
Brighty UI library
27 lines • 2.97 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var InfoCell_module_scss_1 = tslib_1.__importDefault(require("../../../src/styles/InfoCell.module.scss"));
var Typography_1 = tslib_1.__importDefault(require("../Typography/Typography"));
var Info_CircleIcon_1 = require("../../images/IconComponents/Info.CircleIcon");
var EColors_1 = require("../../types/EColors");
var CopyIcon_1 = require("../../images/IconComponents/CopyIcon");
var copyToClipboard_1 = tslib_1.__importDefault(require("../../utils/copyToClipboard"));
var InfoCell = function (_a) {
var icon = _a.icon, title = _a.title, _b = _a.type, type = _b === void 0 ? 'default' : _b, showIcon = _a.showIcon, showCaption = _a.showCaption, caption = _a.caption, value = _a.value, showValue = _a.showValue, showSubvalue = _a.showSubvalue, subvalue = _a.subvalue, showInfo = _a.showInfo, showIconCopy = _a.showIconCopy, infoOnClick = _a.infoOnClick, _c = _a.fontSize, fontSize = _c === void 0 ? 'pSmallRegular' : _c;
var handleCopy = function () {
if (showIconCopy && value && typeof value === 'string') {
(0, copyToClipboard_1.default)(value);
}
};
if (type === 'default') {
return ((0, jsx_runtime_1.jsxs)("div", { className: InfoCell_module_scss_1.default.root, children: [icon, (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: fontSize, children: title })] }));
}
if (type === 'value') {
return ((0, jsx_runtime_1.jsxs)("div", { className: InfoCell_module_scss_1.default.root__value, children: [showIcon && icon, (0, jsx_runtime_1.jsxs)("div", { className: InfoCell_module_scss_1.default.center, children: [(0, jsx_runtime_1.jsxs)("div", { className: InfoCell_module_scss_1.default.center__top, children: [typeof title === 'string' ? (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: fontSize, children: title }) : title, showInfo && ((0, jsx_runtime_1.jsx)("button", { onClick: infoOnClick, className: InfoCell_module_scss_1.default.info, children: (0, jsx_runtime_1.jsx)(Info_CircleIcon_1.InfoCircle, {}) }))] }), showCaption && ((0, jsx_runtime_1.jsx)(Typography_1.default, { variant: fontSize, color: EColors_1.EColors.text2, children: caption }))] }), (0, jsx_runtime_1.jsxs)("div", { className: InfoCell_module_scss_1.default.right, children: [(0, jsx_runtime_1.jsxs)("div", { className: InfoCell_module_scss_1.default.right__top, children: [showValue && (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: fontSize, children: value }), showIconCopy && ((0, jsx_runtime_1.jsx)("button", { onClick: handleCopy, children: (0, jsx_runtime_1.jsx)(CopyIcon_1.CopyIcon, {}) }))] }), showSubvalue && ((0, jsx_runtime_1.jsx)(Typography_1.default, { variant: fontSize, color: EColors_1.EColors.text2, children: subvalue }))] })] }));
}
return null;
};
exports.default = InfoCell;
//# sourceMappingURL=InfoCell.js.map