Skip to content

Commit 28df5c4

Browse files
author
Guillaume Chau
authored
Switch to SVG icons (vuejs#538)
* Initial implementation + test on App tabs * More SVG icons * Tweak * Add/Remove quick edit icons tweaks * Moved to icons plugin * Tooltip icons style tweaks * Fix open-in-editor tooltip
1 parent c3c183f commit 28df5c4

File tree

17 files changed

+202
-135
lines changed

17 files changed

+202
-135
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"launch-editor-middleware": "^2.1.0",
4646
"nightwatch": "^0.9.19",
4747
"nightwatch-helpers": "^1.2.0",
48+
"raw-loader": "^0.5.1",
4849
"selenium-server": "2.52.0",
4950
"semver": "^5.4.1",
5051
"stylus": "^0.54.5",
@@ -59,6 +60,7 @@
5960
"circular-json-es6": "^2.0.1",
6061
"lodash.debounce": "^4.0.8",
6162
"lodash.groupby": "^4.6.0",
63+
"material-design-icons": "^3.0.1",
6264
"uglifyjs-webpack-plugin": "^1.1.4",
6365
"v-tooltip": "^2.0.0-rc.25",
6466
"vue": "^2.5.13",

src/devtools/App.vue

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
v-tooltip="$t('App.components.tooltip')"
1717
@click="switchTab('components')"
1818
>
19-
<i class="material-icons">device_hub</i>
19+
<BaseIcon icon="device_hub"/>
2020
<span class="pane-name">Components</span>
2121
</a>
2222
<a
@@ -25,7 +25,7 @@
2525
v-tooltip="$t('App.vuex.tooltip')"
2626
@click="switchTab('vuex')"
2727
>
28-
<i class="material-icons">restore</i>
28+
<BaseIcon icon="restore"/>
2929
<span class="pane-name">Vuex</span>
3030
</a>
3131
<a
@@ -34,7 +34,7 @@
3434
v-tooltip="$t('App.events.tooltip')"
3535
@click="switchTab('events')"
3636
>
37-
<i class="material-icons">grain</i>
37+
<BaseIcon icon="grain"/>
3838
<span class="pane-name">Events</span>
3939
<span class="event-count" v-if="newEventCount > 0">{{ newEventCount }}</span>
4040
</a>
@@ -43,7 +43,7 @@
4343
v-tooltip="$t('App.refresh.tooltip')"
4444
@click="refresh"
4545
>
46-
<i class="material-icons" ref="refresh">refresh</i>
46+
<BaseIcon ref="refresh" icon="refresh"/>
4747
<span class="pane-name">Refresh</span>
4848
</a>
4949
<span class="active-bar"></span>
@@ -113,7 +113,7 @@ export default {
113113
}
114114
},
115115
refresh () {
116-
const refreshIcon = this.$refs.refresh
116+
const refreshIcon = this.$refs.refresh.$el
117117
refreshIcon.style.animation = 'none'
118118
119119
bridge.send('refresh')
@@ -211,20 +211,27 @@ export default {
211211
.dark &
212212
background-color $dark-background-color
213213
214+
.svg-icon
215+
width 20px
216+
height @width
217+
margin-right 5px
218+
>>> svg
219+
fill @color
220+
transition fill .35s ease
221+
214222
&:hover
215223
color #555
224+
.svg-icon >>> svg
225+
fill @color
216226
217227
&.active
218228
color $active-color
229+
.svg-icon >>> svg
230+
fill @color
219231
220232
&:first-of-type
221233
margin-left auto
222234
223-
.material-icons
224-
font-size 20px
225-
margin-right 5px
226-
color inherit
227-
228235
.pane-name
229236
display none
230237

src/devtools/components/ActionHeader.vue

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,27 @@
3232
&-bracket
3333
color #ccc
3434
35+
.svg-icon
36+
width 16px
37+
height @width
38+
margin-right 0
39+
@media (min-width: $wide)
40+
margin-right 5px
41+
3542
.button
3643
cursor pointer
3744
display flex
3845
align-items center
3946
justify-content center
4047
padding 0 10px
41-
transition opacity 0.25s
48+
transition opacity .25s, color .25s
4249
white-space nowrap
43-
opacity 0.8
50+
opacity .8
4451
overflow hidden
4552
53+
.svg-icon >>> svg
54+
transition fill .25s
55+
4656
&:first-of-type
4757
margin-left auto
4858
@@ -51,6 +61,9 @@
5161
opacity 1
5262
color $active-color
5363
64+
.svg-icon >>> svg
65+
fill @color
66+
5467
&.disabled
5568
opacity 0.45
5669
cursor not-allowed
@@ -60,13 +73,6 @@
6073
@media (min-width: $wide)
6174
display inline
6275
63-
.material-icons
64-
font-size 16px
65-
margin-right 0
66-
color inherit
67-
@media (min-width: $wide)
68-
margin-right 5px
69-
7076
.search
7177
display flex
7278
align-items center

src/devtools/components/DataField.vue

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,25 @@
4848
@keydown.enter="submitEdit()"
4949
>
5050
<span class="actions">
51-
<i
51+
<BaseIcon
5252
v-if="!editValid"
53-
class="icon-button material-icons warning"
53+
class="icon-button warning"
5454
v-tooltip="editErrorMessage"
55-
>warning</i>
55+
icon="warning"
56+
/>
5657
<template v-else>
57-
<i
58-
class="icon-button material-icons"
58+
<BaseIcon
59+
class="icon-button medium"
60+
icon="cancel"
5961
v-tooltip="$t('DataField.edit.cancel.tooltip')"
6062
@click="cancelEdit()"
61-
>close</i>
62-
<i
63-
class="icon-button material-icons"
63+
/>
64+
<BaseIcon
65+
class="icon-button"
66+
icon="save"
6467
v-tooltip="$t('DataField.edit.submit.tooltip')"
6568
@click="submitEdit()"
66-
>done</i>
69+
/>
6770
</template>
6871
</span>
6972
</span>
@@ -76,33 +79,38 @@
7679
v-html="formattedValue"
7780
/>
7881
<span class="actions">
79-
<i
82+
<BaseIcon
8083
v-if="isValueEditable"
81-
class="edit-value icon-button material-icons"
84+
class="edit-value icon-button"
85+
icon="edit"
8286
v-tooltip="'Edit value'"
8387
@click="openEdit()"
84-
>edit</i>
88+
/>
8589
<template v-if="quickEdits">
86-
<i
90+
<BaseIcon
8791
v-for="(info, index) of quickEdits"
8892
:key="index"
89-
class="quick-edit icon-button material-icons"
93+
class="quick-edit icon-button"
94+
:class="info.class"
95+
:icon="info.icon"
9096
v-tooltip="info.title || 'Quick edit'"
9197
@click="quickEdit(info, $event)"
92-
>{{ info.icon }}</i>
98+
/>
9399
</template>
94-
<i
100+
<BaseIcon
95101
v-if="isSubfieldsEditable && !addingValue"
96-
class="add-value icon-button material-icons"
102+
class="add-value icon-button"
103+
icon="add_circle"
97104
v-tooltip="'Add new value'"
98105
@click="addNewValue()"
99-
>add_circle</i>
100-
<i
106+
/>
107+
<BaseIcon
101108
v-if="removable"
102-
class="remove-field icon-button material-icons"
109+
class="remove-field icon-button"
110+
icon="delete"
103111
v-tooltip="'Remove value'"
104112
@click="removeField()"
105-
>delete</i>
113+
/>
106114
</span>
107115
</template>
108116

@@ -431,13 +439,14 @@ export default {
431439
top -1px
432440
.icon-button
433441
user-select none
434-
font-size 14px
442+
width 16px
443+
height @width
435444
&:first-child
436445
margin-left 6px
437446
&:not(:last-child)
438447
margin-right 6px
439-
.warning
440-
color $orange
448+
.warning >>> svg
449+
fill $orange
441450
&:hover,
442451
&.editing
443452
.actions

src/devtools/global.styl

Lines changed: 35 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,36 @@
11
@import "./variables"
22
@import "./transitions"
33

4-
@font-face
5-
font-family 'Material Icons'
6-
font-style normal
7-
font-weight 400
8-
src url(./assets/MaterialIcons-Regular.woff2) format('woff2')
9-
104
@font-face
115
font-family 'Roboto'
126
font-style normal
137
font-weight 400
148
src local('Roboto'), local('Roboto-Regular'), url(./assets/Roboto-Regular.woff2) format('woff2')
159

16-
.material-icons
17-
font-family 'Material Icons'
18-
font-weight normal
19-
font-style normal
20-
font-size 22px
10+
.toggle-recording .svg-icon
11+
svg
12+
fill #999 !important
13+
&.enabled
14+
border-radius 50%
15+
filter: drop-shadow(0 0 3px rgba(255, 0, 0, .4))
16+
svg
17+
fill red !important
18+
19+
.svg-icon
2120
display inline-block
22-
width 1em
23-
height 1em
24-
color #999
25-
line-height 1
26-
text-transform none
27-
letter-spacing normal
28-
word-wrap normal
29-
white-space nowrap
30-
direction ltr
31-
/* Support for all WebKit browsers. */
32-
-webkit-font-smoothing antialiased
33-
/* Support for Safari and Chrome. */
34-
text-rendering optimizeLegibility
35-
/* Support for Firefox. */
36-
-moz-osx-font-smoothing grayscale
21+
width 22px
22+
height @width
23+
svg
24+
width 100%
25+
height 100%
26+
fill #999
27+
&.big
28+
transform scale(1.3)
3729
&.medium
3830
transform scale(0.9)
3931
&.small
4032
transform scale(0.8)
4133

42-
.toggle-recording .material-icons
43-
color #999 !important
44-
&.enabled
45-
color red !important
46-
text-shadow 0 0 3px rgba(255, 0, 0, .4)
47-
4834
html, body
4935
margin 0
5036
padding 0
@@ -121,8 +107,8 @@ $arrow-color = #444
121107

122108
.icon-button
123109
cursor pointer
124-
&:hover
125-
color $green
110+
&:hover svg
111+
fill $green
126112

127113
.scroll
128114
position relative
@@ -142,9 +128,9 @@ $arrow-color = #444
142128
color $white
143129
border-radius 3px
144130
padding 5px 10px
145-
.material-icons
146-
font-size 16px
147-
line-height @font-size
131+
.svg-icon
132+
width 16px
133+
height @width
148134
position relative
149135
top 3px
150136
.tooltip-arrow
@@ -314,9 +300,9 @@ $arrow-color = #444
314300
font-family Menlo, Consolas, monospace
315301

316302
.green
317-
&,
318-
.material-icons
319-
color $green
303+
color $green
304+
.svg-icon svg
305+
fill @color
320306

321307
.grey
322308
&,
@@ -332,18 +318,19 @@ $arrow-color = #444
332318
background $white
333319
color $green
334320
font-size 12px
335-
padding 4px 8px
321+
padding 0px 8px 6px
336322
margin 0 2px
337323
border-radius 2px
338324
display inline-block
325+
vertical-align baseline
339326
.dark &
340327
background $dark-background-color
341328
&,
342329
.tooltip .tooltip-inner &
343-
.material-icons
344-
color #444
345-
vertical-align middle
346-
position relative
347-
top 0
348-
.dark &
349-
color #666
330+
.svg-icon
331+
top 4px
332+
margin-right 4px
333+
svg
334+
fill #444
335+
.dark &
336+
fill #666

src/devtools/locales/en.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ export default {
4444
tooltip: '[[{{keys.ctrl}}]] + [[F]] Filter components by name'
4545
}
4646
},
47+
ComponentInspector: {
48+
openInEditor: {
49+
tooltip: 'Open <mono><<insert_drive_file>>{{file}}</mono> in editor'
50+
}
51+
},
4752
EventsHistory: {
4853
filter: {
4954
tooltip: '[[{{keys.ctrl}}]] + [[F]] To filter on components, type <input><<search>> &lt;MyComponent&gt;</input> or just <input><<search>> &lt;mycomp</input>.'

0 commit comments

Comments
 (0)