Skip to content

Commit ec1c821

Browse files
committed
SVG Icon grows to container size
1 parent a2145ad commit ec1c821

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: client/common/Icon.jsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import InlineSVG from 'react-inlinesvg';
33
import PropTypes from 'prop-types';
44
import React from 'react';
55
import lodash from 'lodash';
6+
import styled from 'styled-components';
67

78
const icons = {
89
sortArrowUp: require('../images/sort-arrow-up.svg'),
@@ -24,10 +25,16 @@ const names = lodash.mapValues(icons, (value, key) => key);
2425

2526
export const ValidIconNameType = PropTypes.oneOf(Object.keys(names));
2627

28+
const StyledInlineSVG = styled(InlineSVG)`
29+
> svg {
30+
width: 100%;
31+
height: 100%;
32+
}
33+
`;
2734

2835
function Icon({ name, ...props }) {
2936
return (
30-
<InlineSVG src={icons[name]} {...props} />
37+
<StyledInlineSVG src={icons[name]} {...props} />
3138
);
3239
}
3340

0 commit comments

Comments
 (0)