Skip to content

Commit 4665dad

Browse files
committed
use styled componnents instead of inline
1 parent 3842748 commit 4665dad

File tree

2 files changed

+4
-8
lines changed
  • packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryIcons

2 files changed

+4
-8
lines changed

packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryIcons/elements.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const RedIcon = styled.span`
77
`;
88

99
export const SVGIcon = styled.span`
10+
background-image: url(${props => props.url});
1011
background-size: ${props => props.width}px;
1112
background-position: 0;
1213
background-repeat: no-repeat;

packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryIcons/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,16 @@ class GetIcon extends Component {
2828

2929
render() {
3030
const { type, error, width, height } = this.props;
31+
const { icon } = this.state;
32+
3133
if (error) {
3234
return (
3335
<RedIcon>
3436
<ErrorIcon width={width} height={height} />
3537
</RedIcon>
3638
);
3739
}
38-
return (
39-
<SVGIcon
40-
style={{ 'background-image': `url(${this.state.icon})` }}
41-
type={type}
42-
width={width}
43-
height={height}
44-
/>
45-
);
40+
return <SVGIcon url={icon} type={type} width={width} height={height} />;
4641
}
4742
}
4843

0 commit comments

Comments
 (0)