synapse-react-client
Version:
[](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client) [](https://badge.fury.io/js/synaps
30 lines • 1.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var IconSvg_1 = (0, tslib_1.__importDefault)(require("./IconSvg"));
var IconList = function (props) {
var iconConfigs = props.iconConfigs, iconNames = props.iconNames, useTheme = props.useTheme, useBackground = props.useBackground;
var noMatch = false;
var css = useTheme ? "icon-list themed" : "icon-list";
var componentCss = useBackground ? css + " bg-circle" : css;
var buildIconList = function () {
var unique = Array.from(new Set(iconNames));
return unique.map(function (el) {
var iconConfig = iconConfigs[el];
// if this data type value doesn't have a matching icon, we use the "other" icon
if (!iconConfig) {
noMatch = true;
return;
}
else {
return react_1.default.createElement(IconSvg_1.default, { key: el, options: iconConfig });
}
});
};
return (react_1.default.createElement("span", { className: componentCss },
buildIconList(),
noMatch && iconConfigs['other'] ? react_1.default.createElement(IconSvg_1.default, { options: iconConfigs['other'] }) : react_1.default.createElement(react_1.default.Fragment, null)));
};
exports.default = IconList;
//# sourceMappingURL=IconList.js.map