UNPKG

@cainiaofe/cn-ui-m

Version:
14 lines (13 loc) 597 B
import React from 'react'; import { CnIcon } from "../cn-icon"; import { RESULT_TYPE_MAP } from './constant'; export var getIcon = function (_icon, type) { var icon = _icon || (type && RESULT_TYPE_MAP()[type].icon); if (!icon) return null; if (icon.startsWith('http') || icon.startsWith('//')) { return (React.createElement("div", { className: "cn-result-img", style: { backgroundImage: "url(".concat(icon, ")") } })); } return (React.createElement("div", { className: "cn-result-icon" }, React.createElement(CnIcon, { size: "xxxl", type: icon }))); };