UNPKG

@test--me/icons

Version:
48 lines (41 loc) 1.02 kB
import React from 'react'; var SIZES = { small: { width: 31, height: 31 }, medium: { width: 42, height: 42 }, large: { width: 51, height: 51 } }; var Icon = function Icon(_ref) { var name = _ref.name, _ref$size = _ref.size, size = _ref$size === void 0 ? 'small' : _ref$size, _ref$fillColor = _ref.fillColor, fillColor = _ref$fillColor === void 0 ? '#000' : _ref$fillColor; var IconComponent = undefined; try { IconComponent = require("!babel-loader!react-svg-loader!./svgs/".concat(name, ".svg"))["default"]; } catch (error) { console.warn('Cannot read file'); } if (typeof IconComponent === 'undefined') { return null; } return /*#__PURE__*/React.createElement(IconComponent, { className: "".concat(name, "-").concat(size), preserveAspectRatio: "none", xmlSpace: "default", viewBox: "0 0 100 100", fill: fillColor, width: SIZES[size].width, height: SIZES[size].height }); }; export { Icon };