-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIcon.js
More file actions
41 lines (36 loc) · 984 Bytes
/
Icon.js
File metadata and controls
41 lines (36 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from "react";
import PropTypes from "prop-types";
import iconPath from ".iconsLib";
const defaultStyles = { display: "inline-block", verticalAlign: "middle" };
const Icon = ({ size, color, icon, className, style, viewBox }) => {
const styles = { ...defaultStyles, ...style };
return (
<svg
className={className}
style={styles}
viewBox={viewBox}
width={`${size}px`}
height={`${size}px`}
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
>
<path fill={color} d={iconPath[icon]} />
</svg>
);
};
Icon.defaultProps = {
size: 16,
color: "#000000",
viewBox: "0 0 24 24",
style: {},
className: "",
};
Icon.propTypes = {
size: PropTypes.number.isRequired,
color: PropTypes.string.isRequired,
icon: PropTypes.string.isRequired,
viewBox: PropTypes.string.isRequired,
style: PropTypes.shape(PropTypes.object),
className: PropTypes.string,
};
export default Icon;