UNPKG

sccoreui

Version:

ui-sccore

34 lines (33 loc) 2.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const svg_icons_1 = require("./svg-icons"); const collorPallet = { primary: "var(--primary-700)", secondary: "var(--yellow-700)", success: "var(--green-700)", error: "var(--red-700)", }; const colorFunction = (data) => { if (data === null || data === void 0 ? void 0 : data.includes("text")) { return `var(-${data.replace("text", "")})`; } else if (data === null || data === void 0 ? void 0 : data.includes("#")) { return data; } else if (Object.keys(collorPallet).includes(data)) { return collorPallet[data]; } else { return data; } }; const SvgComponent = ({ icon, size, color, className, disabled, title, }) => { const data2 = svg_icons_1.iconList.find((iconObject) => iconObject.name === icon); const data = data2 === null || data2 === void 0 ? void 0 : data2.svg.replace('width="24" height="24"', `width=${size ? `${size}` : 16} size=${size ? `${size}` : 16}`).replace('stroke="#667085"', `stroke=${color ? colorFunction(color) : "#667085"}`).replace('stroke="#667085"', `stroke=${color ? colorFunction(color) : "#667085"}`).replace('stroke="#667085"', `stroke=${color ? colorFunction(color) : "#667085"}`).replace('stroke="#667085"', `stroke=${color ? colorFunction(color) : "#667085"}`).replace('stroke="#667085"', `stroke=${color ? colorFunction(color) : "#667085"}`).replace('stroke="#667085"', `stroke=${color ? colorFunction(color) : "#667085"}`).replace('stroke="#667085"', `stroke=${color ? colorFunction(color) : "#667085"}`).replace('stroke="#667085"', `stroke=${color ? colorFunction(color) : "#667085"}`).replace('stroke="#667085"', `stroke=${color ? colorFunction(color) : "#667085"}`).replace('stroke="#667085"', `stroke=${color ? colorFunction(color) : "#667085"}`).replace('stroke="#667085"', `stroke=${color ? colorFunction(color) : "#667085"}`); if (data === undefined) { return null; } return ((0, jsx_runtime_1.jsx)("span", { className: `flex align-items-center justify-content-center${!className ? "" : ` ${className}`} ${disabled && "p-disabled"}`, dangerouslySetInnerHTML: { __html: data }, title: title })); }; exports.default = SvgComponent;