1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.Icon = void 0;
|
7 |
|
8 | var _preact = require("preact");
|
9 |
|
10 | var _classnames = _interopRequireDefault(require("classnames"));
|
11 |
|
12 | var _omit = _interopRequireDefault(require("./utils/omit"));
|
13 |
|
14 | var _pillIcon = _interopRequireDefault(require("./pill-icon"));
|
15 |
|
16 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17 |
|
18 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
19 |
|
20 | const customIcons = {
|
21 | pill: _pillIcon.default
|
22 | };
|
23 |
|
24 | const Icon = props => {
|
25 | const {
|
26 | icon,
|
27 | size,
|
28 | className,
|
29 | style
|
30 | } = props;
|
31 | const rest = (0, _omit.default)(props, ['icon', 'size', 'className']);
|
32 | const px = "".concat(size || 24, "px");
|
33 | const styles = Object.assign({}, style, {
|
34 | fontSize: px,
|
35 | width: px,
|
36 | height: px
|
37 | });
|
38 | const Custom = customIcons[icon];
|
39 | return (0, _preact.h)("i", _extends({}, rest, {
|
40 | style: styles,
|
41 | className: (0, _classnames.default)('dib', {
|
42 | 'material-icons': !Custom
|
43 | }, className)
|
44 | }), Custom ? (0, _preact.h)(Custom, null) : icon);
|
45 | };
|
46 |
|
47 | exports.Icon = Icon; |
\ | No newline at end of file |