forked from zoltantothcom/Design-Patterns-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSvg.jsx
More file actions
34 lines (29 loc) · 730 Bytes
/
Svg.jsx
File metadata and controls
34 lines (29 loc) · 730 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
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { getMode } from '../selectors';
import { JS, SUN_OUTLINED, SUN_FILLED } from '../static/icons';
const SVG = ({ control, mode }) => {
let icon = JS;
if (control === 'mode') {
icon = mode === 'dark' ? SUN_OUTLINED : SUN_FILLED;
}
return (
<svg
height="100%"
width="100%"
viewBox="0 0 24 23"
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
>
{icon}
</svg>
);
};
SVG.propTypes = {
control: PropTypes.string.isRequired,
mode: PropTypes.string.isRequired
};
export default connect(state => ({
mode: getMode(state)
}))(SVG);