react-lordicon
Version:
Lordicon library animated icons to React
85 lines (77 loc) • 2.57 kB
JavaScript
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
require('https://cdn.lordicon.com/xdjxvujz.js');
var React = _interopDefault(require('react'));
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
var _excluded = ["colors", "icon", "delay", "trigger", "size"];
var Lordicon = function Lordicon(_ref) {
var _ref$colors = _ref.colors,
colors = _ref$colors === void 0 ? {
primary: '#fff',
secondary: '#fff'
} : _ref$colors,
_ref$icon = _ref.icon,
icon = _ref$icon === void 0 ? 'helpCenter' : _ref$icon,
_ref$delay = _ref.delay,
delay = _ref$delay === void 0 ? 1000 : _ref$delay,
_ref$trigger = _ref.trigger,
trigger = _ref$trigger === void 0 ? 'loop' : _ref$trigger,
_ref$size = _ref.size,
size = _ref$size === void 0 ? 20 : _ref$size,
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
var cdnLordiconBaseUrl = 'https://cdn.lordicon.com/';
var lordiconIcons = {
bolt: 'giaigwkd.json',
helpCenter: 'njjuilvq.json',
info: 'aixyixpa.json',
notificationBell: 'ndydpcaq.json',
error: 'otyynlki.json',
warning: 'rslnizbt.json',
helpQuestion: 'keogyrep.json',
alarm: 'rinkvymq.json',
arrowUp: 'eflfmgmj.json',
arrowDown: 'xhdhjyqy.json',
chat: 'uvextprq.json',
clock: 'abgtphux.json',
autorenew: 'sihdhmit.json',
trash: 'dovoajyj.json',
article: 'sygggnra.json',
history: 'lefmybnc.json',
play: 'fetyzpiw.json',
addCard: 'auvicynv.json',
thumbsUpDown: 'rahcoaeu.json',
cross: 'vfzqittk.json',
spaFlower: 'dqunxaob.json',
snake: 'jlkaerma.json',
ruins: 'uixzulhh.json',
privacyPolicy: 'yyecauzv.json',
edit: 'wloilxuq.json',
bin: 'gsqxdxog.json',
flatArrow: 'iifryyua.json'
};
var lordiconIcon = lordiconIcons[icon];
var lordicon = React.createElement("lord-icon", Object.assign({}, rest, {
colors: "primary:" + colors.primary + ",secondary:" + colors.secondary,
src: "" + cdnLordiconBaseUrl + lordiconIcon,
trigger: trigger,
delay: delay,
style: {
width: size,
height: size
}
}));
return lordicon;
};
exports.Lordicon = Lordicon;
exports.default = Lordicon;
//# sourceMappingURL=index.js.map