Skip to content

Commit c3c3bb1

Browse files
committed
popup: move remove button to overflow/toggle menu to support further actions in the future
1 parent 1d95857 commit c3c3bb1

File tree

2 files changed

+72
-5
lines changed

2 files changed

+72
-5
lines changed

src/popup/components/InstanceItem.vue

+22-5
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,26 @@
5050
</div>
5151
</div>
5252
<div id="right">
53-
<div class="instance-icon-bar-remove">
54-
<RemoveIcon
55-
@click="toggleRemove"
53+
<div class="instance-icon-bar-chevron">
54+
<ChevronIcon
55+
:orientation="showHidden ? 'up' : 'down'"
56+
@click="toggleHidden"
5657
/>
5758
</div>
5859
</div>
5960
</div>
6061
</div>
6162
</div>
63+
<div
64+
v-if="showHidden"
65+
class="instance-hidden-icon-bar"
66+
>
67+
<div class="instance-icon-bar-remove">
68+
<RemoveIcon
69+
@click="toggleRemove"
70+
/>
71+
</div>
72+
</div>
6273
<div
6374
v-if="showRemove"
6475
class="delete-section"
@@ -78,13 +89,15 @@ import stripHtml from '../../shared/util/stripHtml'
7889
import ViewerIcon from './icons/ViewerIcon.vue'
7990
import UptimeIcon from './icons/UptimeIcon.vue'
8091
import RemoveIcon from './icons/RemoveIcon.vue'
92+
import ChevronIcon from './icons/ChevronIcon.vue'
8193
8294
export default {
8395
name: 'InstanceItem',
8496
components: {
8597
ViewerIcon,
8698
UptimeIcon,
8799
RemoveIcon,
100+
ChevronIcon,
88101
},
89102
props: {
90103
instance: {
@@ -94,6 +107,7 @@ export default {
94107
},
95108
data () {
96109
return {
110+
showHidden: false,
97111
showRemove: false,
98112
}
99113
},
@@ -108,6 +122,9 @@ export default {
108122
},
109123
},
110124
methods: {
125+
toggleHidden () {
126+
this.showHidden = !this.showHidden
127+
},
111128
toggleRemove () {
112129
this.showRemove = !this.showRemove
113130
},
@@ -201,12 +218,12 @@ export default {
201218
}
202219
}
203220
204-
.instance-icon-bar {
221+
.instance-icon-bar, .instance-hidden-icon-bar {
205222
display: flex;
206223
justify-content: space-between;
207224
align-items: center;
208225
209-
.instance-icon-bar-viewers, .instance-icon-bar-uptime, .instance-icon-bar-remove {
226+
.instance-icon-bar-viewers, .instance-icon-bar-uptime, .instance-icon-bar-chevron, .instance-icon-bar-remove {
210227
display: inline-block;
211228
vertical-align: middle;
212229
}
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<template>
2+
<svg
3+
xmlns="http://www.w3.org/2000/svg"
4+
class="chevron-icon"
5+
:class="`chevron-icon-${orientation}`"
6+
viewBox="0 0 20 20"
7+
fill="currentColor"
8+
@click="emitClick"
9+
>
10+
<path
11+
fill-rule="evenodd"
12+
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
13+
clip-rule="evenodd"
14+
/>
15+
</svg>
16+
</template>
17+
18+
<script>
19+
export default {
20+
name: 'ChevronIcon',
21+
props: {
22+
orientation: {
23+
type: String,
24+
default: 'down',
25+
},
26+
},
27+
emits: [
28+
'click',
29+
],
30+
methods: {
31+
emitClick () {
32+
this.$emit('click')
33+
},
34+
},
35+
}
36+
</script>
37+
38+
<style lang="scss">
39+
.chevron-icon {
40+
flex-shrink: 0;
41+
width: 1rem;
42+
height: 1rem;
43+
cursor: pointer;
44+
}
45+
46+
.chevron-icon-up {
47+
transform: rotate(180deg);
48+
}
49+
50+
</style>

0 commit comments

Comments
 (0)