-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathFeatherIcon.js
49 lines (45 loc) · 1.11 KB
/
FeatherIcon.js
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
42
43
44
45
46
47
48
49
import React from 'react';
import PropTypes from 'prop-types';
import IconInner from './IconInner';
/**
* Feather icon
* otherProps spread will be removed in version 1.
* @param {icon} icon name that matches from feathericons
* @returns FeatherIcon react component
*/
const FeatherIcon = ({
icon,
size = 24,
className = '',
fill = 'none',
strokeWidth = 2,
...otherProps
}) => {
if (!icon) {
return null;
}
return (
<svg
width={size}
height={size}
viewBox="0 0 24 24"
fill={fill}
stroke="currentColor"
strokeWidth={strokeWidth}
strokeLinecap="round"
strokeLinejoin="round"
className={`feather feather-${icon} ${className}`}
{...otherProps}
>
<IconInner icon={icon} />
</svg>
);
};
FeatherIcon.propTypes = {
icon: PropTypes.string.isRequired, // the icon name that matches exactly from feathericons
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
className: PropTypes.string,
fill: PropTypes.string,
strokeWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
export default FeatherIcon;