@light-sheet/react
Version:
FortuneSheet is a drop-in javascript spreadsheet library that provides rich features like Excel and Google Sheets
38 lines • 1.09 kB
JavaScript
import React, { useMemo } from "react";
var CustomIcon = function CustomIcon(_ref) {
var iconName = _ref.iconName,
_ref$width = _ref.width,
width = _ref$width === void 0 ? 24 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 24 : _ref$height,
content = _ref.content;
var innrContent = useMemo(function () {
if (iconName) {
return /*#__PURE__*/React.createElement("svg", {
width: width,
height: height
}, /*#__PURE__*/React.createElement("use", {
xlinkHref: "#".concat(iconName)
}));
}
if (content) {
return content;
}
return /*#__PURE__*/React.createElement("svg", {
width: width,
height: width
}, /*#__PURE__*/React.createElement("use", {
xlinkHref: "#default"
}));
}, [content, height, iconName, width]);
return /*#__PURE__*/React.createElement("div", {
style: {
width: width,
height: height,
display: "flex",
justifyContent: "center",
alignItems: "center"
}
}, innrContent);
};
export default CustomIcon;