UNPKG

epn-ui

Version:

Дизайн система кабинета ВМ

29 lines (26 loc) 1.37 kB
import React from 'react'; import clsx from 'clsx'; import dayjs from 'dayjs'; var StatusDisplay = function (_a) { var _b, _c; var currentStatus = _a.currentStatus, allStatuses = _a.allStatuses, date = _a.date, _d = _a.format, format = _d === void 0 ? 'DD-MM-YYYY HH:mm' : _d, className = _a.className, _e = _a.align, align = _e === void 0 ? 'right' : _e; var getDate = function () { try { if (typeof date === 'undefined') return ''; var dateOject = dayjs(date); if (!dateOject.isValid()) return date; return dateOject.format(format); } catch (err) { console.error(err); return ''; } }; var statusDateTime = getDate(); return (React.createElement("div", { className: clsx('epn-tablePro__statusDisplay', className) }, React.createElement("div", { className: "epn-tablePro__statusDisplay__value", style: { color: (_b = allStatuses[currentStatus]) === null || _b === void 0 ? void 0 : _b.color, textAlign: align } }, (_c = allStatuses[currentStatus]) === null || _c === void 0 ? void 0 : _c.title), statusDateTime && (React.createElement("div", { className: "epn-tablePro__statusDisplay__date" }, statusDateTime)))); }; export { StatusDisplay, StatusDisplay as default };