1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | var _react = require('react');
|
8 |
|
9 | var _react2 = _interopRequireDefault(_react);
|
10 |
|
11 | var _propTypes = require('prop-types');
|
12 |
|
13 | var _propTypes2 = _interopRequireDefault(_propTypes);
|
14 |
|
15 | var _generatedList = require('../../assets/icons/generated-list');
|
16 |
|
17 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18 |
|
19 | var Icon = function Icon(props) {
|
20 | var name = props.name,
|
21 | width = props.width,
|
22 | height = props.height,
|
23 | fill = props.fill,
|
24 | className = props.className,
|
25 | onClick = props.onClick;
|
26 |
|
27 |
|
28 | var obj = _generatedList.paths.find(function (item) {
|
29 | return item.name === name;
|
30 | });
|
31 |
|
32 | var createMarkup = function createMarkup(data) {
|
33 | return { __html: data };
|
34 | };
|
35 |
|
36 | var getData = function getData() {
|
37 | if (obj === undefined) return;
|
38 |
|
39 | var data = obj !== undefined && obj.data;
|
40 |
|
41 | return data;
|
42 | };
|
43 |
|
44 | return _react2.default.createElement('svg', {
|
45 | role: 'img',
|
46 | name: name,
|
47 | width: width,
|
48 | height: height,
|
49 | fill: fill,
|
50 | className: className,
|
51 | onClick: onClick,
|
52 | style: onClick && { cursor: 'pointer' },
|
53 | viewBox: '0 0 24 24'
|
54 |
|
55 |
|
56 |
|
57 | , dangerouslySetInnerHTML: createMarkup(getData()) });
|
58 | };
|
59 |
|
60 | Icon.defaultProps = {
|
61 | height: '24',
|
62 | width: '24'
|
63 | };
|
64 |
|
65 | Icon.propTypes = {
|
66 | |
67 |
|
68 |
|
69 | name: _propTypes2.default.string.isRequired,
|
70 | |
71 |
|
72 |
|
73 | width: _propTypes2.default.string,
|
74 | |
75 |
|
76 |
|
77 | height: _propTypes2.default.string,
|
78 | |
79 |
|
80 |
|
81 | fill: _propTypes2.default.string,
|
82 | |
83 |
|
84 |
|
85 | className: _propTypes2.default.string,
|
86 | |
87 |
|
88 |
|
89 | onClick: _propTypes2.default.func
|
90 | };
|
91 |
|
92 | exports.default = Icon; |
\ | No newline at end of file |