Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 01206f7

Browse files
committed
remove inline-react-svg plugin && fix error/warning
1 parent 6c41692 commit 01206f7

File tree

15 files changed

+250
-124
lines changed

15 files changed

+250
-124
lines changed

containers/Body/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ import {
2121
Router,
2222
Admin,
2323
Search,
24-
SearchIcon,
2524
Notification,
26-
NotificationIcon,
25+
HeaderIcon,
2726
User,
28-
UserIcon,
2927
BannerLogo,
3028
} from './styles'
3129

@@ -37,13 +35,13 @@ const AppHeader = () => {
3735
<Button>管理页</Button>
3836
</Admin>
3937
<Search onClick={logic.openDoraemon}>
40-
<SearchIcon />
38+
<HeaderIcon path={getSVGIconPath('header_search')} />
4139
</Search>
4240
<Notification onClick={logic.openPreview}>
43-
<NotificationIcon />
41+
<HeaderIcon path={getSVGIconPath('notification')} />
4442
</Notification>
4543
<User onClick={logic.openPreview.bind(this, 'user')}>
46-
<UserIcon />
44+
<HeaderIcon path={getSVGIconPath('header_user')} />
4745
</User>
4846
</Header>
4947
)

containers/Body/styles/index.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ import ReactSVG from 'react-svg'
33

44
import { theme } from '../../../utils/themes'
55

6-
import searchIcon from '../../../static/search.svg'
7-
import userIcon from '../../../static/user.svg'
8-
import notificationIcon from '../../../static/notification.svg'
9-
106
export const Body = styled.div`
117
padding-left: 56px;
128
position: relative;
@@ -38,18 +34,11 @@ export const Search = styled.div`
3834
margin-right: 10px;
3935
`
4036

41-
export const SearchIcon = styled(searchIcon)`
42-
fill: grey;
43-
width: 22px;
44-
height: 22px;
45-
cursor: pointer;
46-
`
47-
4837
export const Notification = styled.div`
4938
color: grey;
5039
margin-right: 10px;
5140
`
52-
export const NotificationIcon = styled(notificationIcon)`
41+
export const HeaderIcon = styled(ReactSVG)`
5342
fill: grey;
5443
width: 22px;
5544
height: 22px;
@@ -60,12 +49,6 @@ export const User = styled.div`
6049
margin-right: 20px;
6150
`
6251

63-
export const UserIcon = styled(userIcon)`
64-
fill: grey;
65-
width: 22px;
66-
height: 22px;
67-
cursor: pointer;
68-
`
6952
export const Banner = styled.div`
7053
padding: 5px;
7154
padding-left: 80px;

containers/Doraemon/InputEditor.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ export default class InputEditor extends React.Component {
6969
return (
7070
<EditorBar>
7171
<AddOn>
72-
{searching ? <LoadingIcon /> : <PrefixIcon prefix={prefix} />}
72+
{searching ? (
73+
<LoadingIcon path={getSVGIconPath('search_loading')} />
74+
) : (
75+
<PrefixIcon prefix={prefix} />
76+
)}
7377
</AddOn>
7478
<InputBar
7579
id="doraemonInputbar"

containers/Doraemon/styles/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import ReactSVG from 'react-svg'
33

44
import { theme } from '../../../utils/themes'
55
import { Img } from '../../../components'
6-
import loadingIcon from '../../../static/searchLoading.svg'
76

87
const rotate360 = keyframes`
98
from {
@@ -15,7 +14,7 @@ const rotate360 = keyframes`
1514
}
1615
`
1716

18-
export const LoadingIcon = styled(loadingIcon)`
17+
export const LoadingIcon = styled(ReactSVG)`
1918
fill: ${theme('shell.search_icon')};
2019
width: 30px;
2120
height: 30px;

containers/GithubSearchPanel/index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ import { inject, observer } from 'mobx-react'
1111
// import styled from 'styled-components'
1212

1313
import A from '../../components/A'
14-
import { makeDebugger, storeSelector } from '../../utils/functions'
14+
import {
15+
makeDebugger,
16+
storeSelector,
17+
getSVGIconPath,
18+
} from '../../utils/functions'
1519
import * as logic from './logic'
1620

1721
import {
@@ -38,7 +42,13 @@ const debug = makeDebugger('C:UniversePanel')
3842

3943
const SearchEditor = ({ value, searching }) => (
4044
<EditorBar>
41-
<AddOn>{searching ? <LoadingIcon /> : <SearchIcon />}</AddOn>
45+
<AddOn>
46+
{searching ? (
47+
<LoadingIcon path={getSVGIconPath('search_loading')} />
48+
) : (
49+
<SearchIcon path={getSVGIconPath('search')} />
50+
)}
51+
</AddOn>
4252
<InputBar
4353
spellCheck={false}
4454
autoCapitalize="off"

containers/GithubSearchPanel/styles/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import styled, { keyframes } from 'styled-components'
2+
import ReactSVG from 'react-svg'
23
import { placeholder } from 'polished'
34

45
import { theme } from '../../../utils/themes'
56

67
import { Img } from '../../../components'
78

8-
import searchIcon from '../../../static/search.svg'
9-
import loadingIcon from '../../../static/searchLoading.svg'
10-
119
const rotate360 = keyframes`
1210
from {
1311
transform: rotate(0deg);
@@ -18,14 +16,14 @@ const rotate360 = keyframes`
1816
}
1917
`
2018

21-
export const SearchIcon = styled(searchIcon)`
19+
export const SearchIcon = styled(ReactSVG)`
2220
fill: ${theme('shell.search_icon')};
2321
width: 30px;
2422
height: 30px;
2523
margin-top: 20px;
2624
`
2725

28-
export const LoadingIcon = styled(loadingIcon)`
26+
export const LoadingIcon = styled(ReactSVG)`
2927
fill: ${theme('shell.search_icon')};
3028
width: 30px;
3129
height: 30px;

containers/IntroBody/I18n.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
import React from 'react'
22
import styled from 'styled-components'
3-
3+
import ReactSVG from 'react-svg'
44
import { FormattedMessage as I18n } from 'react-intl'
55

66
import lang from './lang'
7+
import { getSVGIconPath } from '../../utils/functions'
78

89
import { Button } from './styles'
910
import { Center, HorizontalCenter, Title } from '../../components/BaseStyled'
1011

1112
import * as logic from './logic'
1213

13-
import EnIcon from '../../static/en_guard.svg'
14-
import CnIcon from '../../static/cn_panda.svg'
15-
16-
const EnglishFlag = styled(EnIcon)`
14+
const EnglishFlag = styled(ReactSVG)`
1715
width: 3vh;
1816
margin-right: 10px;
1917
position: relative;
2018
top: 2px;
2119
`
2220

23-
const ChinaFlag = styled(CnIcon)`
21+
const ChinaFlag = styled(ReactSVG)`
2422
width: 3vh;
2523
margin-right: 10px;
2624
position: relative;
@@ -35,11 +33,11 @@ const I18nPage = () => {
3533
<I18n {...lang.i18nTitle} />
3634
</Title>
3735
<Button onClick={logic.changeLocale.bind(this, 'en')}>
38-
<EnglishFlag />
36+
<EnglishFlag path={getSVGIconPath('en_guard')} />
3937
<I18n {...lang.i18nEn} />
4038
</Button>
4139
<Button onClick={logic.changeLocale.bind(this, 'zh')}>
42-
<ChinaFlag />
40+
<ChinaFlag path={getSVGIconPath('cn_panda')} />
4341
<I18n {...lang.i18nZh} />
4442
</Button>
4543
</HorizontalCenter>

package.json

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,6 @@
5353
"libraryName": "antd"
5454
}
5555
],
56-
[
57-
"inline-react-svg",
58-
{
59-
"svgo": {
60-
"plugins": [
61-
{
62-
"removeAttrs": {
63-
"attrs": "(data-name)"
64-
}
65-
},
66-
{
67-
"cleanupIDs": true
68-
}
69-
]
70-
}
71-
}
72-
],
7356
"ramda"
7457
],
7558
"env": {
@@ -137,7 +120,6 @@
137120
"babel-eslint": "^8.0.0",
138121
"babel-jest": "^21.0.2",
139122
"babel-plugin-import": "^1.6.2",
140-
"babel-plugin-inline-react-svg": "^0.4.0",
141123
"babel-plugin-ramda": "^1.4.3",
142124
"babel-plugin-react-intl": "^2.3.1",
143125
"babel-plugin-styled-components": "1.3.0",

static/nodeIcons/cmd/cn_panda.svg

Lines changed: 64 additions & 0 deletions
Loading

static/nodeIcons/cmd/en_guard.svg

Lines changed: 50 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)