UNPKG

@zohodesk/components

Version:

Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development

45 lines (42 loc) 1.27 kB
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import React from 'react'; import ColoredTag from "../ColoredTag/ColoredTag"; import ColorIndicator from "../ColorIndicator/ColorIndicator"; import { DUMMY_OBJECT } from "../../../utils/Common"; export function renderColoredTag(data) { const { option, ...otherData } = data || DUMMY_OBJECT; const { colorConfig, value, id } = option || DUMMY_OBJECT; const { text, background, border } = colorConfig || DUMMY_OBJECT; function getColorConfig() { return { backgroundColor: background, textColor: text, borderColor: border }; } return /*#__PURE__*/React.createElement(ColoredTag, _extends({ text: value, id: id }, otherData, { colorConfig: getColorConfig() })); } export function renderColorIndicator(data) { const { colorConfig } = data; return /*#__PURE__*/React.createElement(ColorIndicator, { colorConfig: colorConfig }); }