UNPKG

brightyui

Version:

Brighty UI library

24 lines 2.22 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import styles from '../../../src/styles/InfoCell.module.scss'; import Typography from '../Typography/Typography'; import { InfoCircle } from '../../images/IconComponents/Info.CircleIcon'; import { EColors } from '../../types/EColors'; import { CopyIcon } from '../../images/IconComponents/CopyIcon'; import copyValueToClipboard from '../../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') { copyValueToClipboard(value); } }; if (type === 'default') { return (_jsxs("div", { className: styles.root, children: [icon, _jsx(Typography, { variant: fontSize, children: title })] })); } if (type === 'value') { return (_jsxs("div", { className: styles.root__value, children: [showIcon && icon, _jsxs("div", { className: styles.center, children: [_jsxs("div", { className: styles.center__top, children: [typeof title === 'string' ? _jsx(Typography, { variant: fontSize, children: title }) : title, showInfo && (_jsx("button", { onClick: infoOnClick, className: styles.info, children: _jsx(InfoCircle, {}) }))] }), showCaption && (_jsx(Typography, { variant: fontSize, color: EColors.text2, children: caption }))] }), _jsxs("div", { className: styles.right, children: [_jsxs("div", { className: styles.right__top, children: [showValue && _jsx(Typography, { variant: fontSize, children: value }), showIconCopy && (_jsx("button", { onClick: handleCopy, children: _jsx(CopyIcon, {}) }))] }), showSubvalue && (_jsx(Typography, { variant: fontSize, color: EColors.text2, children: subvalue }))] })] })); } return null; }; export default InfoCell; //# sourceMappingURL=InfoCell.js.map