-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathIconBase.js
54 lines (49 loc) · 1.16 KB
/
IconBase.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
50
51
52
53
54
// @flow
import * as React from 'react';
import styled from 'styled-components';
type Props = {
children: React.Node,
width?: number,
height?: number,
iconName?: string,
iconColor?: string,
style?: { [string]: string | number },
};
export default class Icon extends React.Component<Props> {
static defaultProps = {
width: 18,
height: 18,
iconName: 'box',
iconColor: 'currentColor',
};
render() {
const { width, height, iconName, iconColor, children, style } = this.props;
return (
<FormattedSvg
xmlns="http://www.w3.org/2000/svg"
width={width}
height={height}
viewBox="0 0 24 24"
aria-labelledby={iconName}
role="presentation"
style={style}
>
<title id={iconName} lang="en">
{iconName} icon
</title>
<g fill={iconColor}>{children}</g>
</FormattedSvg>
);
}
}
const FormattedSvg = styled.svg`
display: inline-block;
vertical-align: baseline;
/*
Sarah in the original app about the next line:
"yes, I'm that particular about formatting"
Xavier adapting to NextJS:
"🙌"
*/
margin-bottom: -2px;
`;