Skip to content

Commit 1a9100e

Browse files
authored
Change dropdown to use bootstrap (#200)
1 parent 288b08e commit 1a9100e

1 file changed

Lines changed: 29 additions & 176 deletions

File tree

Lines changed: 29 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
11
<template>
2-
<div class="triage-bucket-dropdown">
3-
<a class="btn btn-default" data-testid="triage-trigger" @click="showPanel">
2+
<div class="btn-group">
3+
<a
4+
class="btn btn-default dropdown-toggle"
5+
data-toggle="dropdown"
6+
href="#"
7+
role="button"
8+
data-testid="triage-trigger"
9+
>
410
{{ currentStatus ? "Change triage status" : "Mark triaged" }}
11+
<span class="caret"></span>
512
</a>
6-
7-
<div v-if="isPanelVisible" class="triage-panel" data-testid="triage-panel">
8-
<div class="panel-header">Select status</div>
9-
<div class="panel-options">
13+
<ul class="dropdown-menu" data-testid="triage-panel">
14+
<li
15+
v-for="choice in choices"
16+
:key="choice.value"
17+
:class="{ active: choice.value === currentStatus }"
18+
>
1019
<a
11-
v-for="choice in choices"
12-
:key="choice.value"
13-
class="panel-option"
14-
:class="{ 'panel-option--selected': choice.value === currentStatus }"
20+
href="#"
1521
:data-testid="`triage-option-${choice.value}`"
16-
@click="choice.value !== currentStatus && selectStatus(choice.value)"
22+
@click.prevent="
23+
choice.value !== currentStatus && selectStatus(choice.value)
24+
"
1725
>
18-
<span class="option-rail"></span>
19-
<span class="option-label">{{ choice.label }}</span>
20-
<span v-if="choice.value === currentStatus" class="option-check"
21-
>✓</span
22-
>
26+
{{ choice.label }}
2327
</a>
24-
</div>
25-
<div v-if="currentStatus" class="panel-danger-zone">
28+
</li>
29+
<li v-if="currentStatus" class="divider" role="presentation"></li>
30+
<li v-if="currentStatus">
2631
<a
27-
class="panel-option panel-option--unmark"
32+
href="#"
33+
class="text-danger"
2834
data-testid="triage-unmark"
29-
@click="selectStatus(null)"
35+
@click.prevent="selectStatus(null)"
36+
>Unmark triaged</a
3037
>
31-
<span class="option-rail"></span>
32-
<span class="option-label">Unmark triaged</span>
33-
</a>
34-
</div>
35-
<div class="panel-footer">
36-
<a class="panel-cancel" @click="hidePanel">Cancel</a>
37-
</div>
38-
</div>
39-
40-
<div v-if="isPanelVisible" class="panel-backdrop" @click="hidePanel"></div>
38+
</li>
39+
</ul>
4140
</div>
4241
</template>
4342

@@ -59,156 +58,10 @@ export default {
5958
},
6059
},
6160
emits: ["update"],
62-
data() {
63-
return {
64-
isPanelVisible: false,
65-
};
66-
},
6761
methods: {
68-
showPanel() {
69-
this.isPanelVisible = true;
70-
},
71-
hidePanel() {
72-
this.isPanelVisible = false;
73-
},
7462
selectStatus(status) {
75-
this.isPanelVisible = false;
7663
this.$emit("update", status);
7764
},
7865
},
7966
};
8067
</script>
81-
82-
<style scoped>
83-
.triage-bucket-dropdown {
84-
display: inline-block;
85-
position: relative;
86-
}
87-
88-
.triage-panel {
89-
position: absolute;
90-
top: calc(100% + 5px);
91-
left: 0;
92-
background: #fff;
93-
border: 1px solid #ccc;
94-
border-radius: 5px;
95-
z-index: 1000;
96-
min-width: 210px;
97-
overflow: hidden;
98-
}
99-
100-
.panel-header {
101-
background: #fafafa;
102-
padding: 9px 14px 8px;
103-
border-bottom: 1px solid #eee;
104-
font-weight: bold;
105-
}
106-
107-
.panel-options {
108-
padding: 4px 0;
109-
}
110-
111-
.panel-option {
112-
display: flex;
113-
align-items: center;
114-
padding: 0;
115-
cursor: pointer;
116-
color: #333;
117-
text-decoration: none;
118-
}
119-
120-
.panel-option:hover {
121-
background-color: #f7f7f7;
122-
text-decoration: none;
123-
color: #333;
124-
}
125-
126-
.option-rail {
127-
display: block;
128-
width: 3px;
129-
align-self: stretch;
130-
background-color: transparent;
131-
flex-shrink: 0;
132-
border-radius: 0 2px 2px 0;
133-
}
134-
135-
.panel-option:hover .option-rail {
136-
background-color: #ccc;
137-
}
138-
139-
.panel-option--selected .option-rail {
140-
background-color: #0066cc;
141-
}
142-
143-
.option-label {
144-
flex: 1;
145-
padding: 8px 12px 8px 10px;
146-
font-size: 13px;
147-
line-height: 1.3;
148-
}
149-
150-
.option-check {
151-
padding-right: 12px;
152-
font-size: 11px;
153-
color: #0066cc;
154-
font-weight: 700;
155-
}
156-
157-
.panel-option--selected {
158-
background-color: #f0f6ff;
159-
cursor: default;
160-
pointer-events: none;
161-
}
162-
163-
.panel-option--selected .option-label {
164-
color: #0055aa;
165-
font-weight: 600;
166-
}
167-
168-
.panel-danger-zone {
169-
border-top: 1px solid #eee;
170-
}
171-
172-
.panel-option--unmark .option-label {
173-
color: #c0392b;
174-
}
175-
176-
.panel-option--unmark:hover {
177-
background-color: #fdf4f3;
178-
}
179-
180-
.panel-option--unmark:hover .option-rail {
181-
background-color: #c0392b;
182-
}
183-
184-
.panel-option--unmark:hover .option-label {
185-
color: #a93226;
186-
}
187-
188-
.panel-footer {
189-
padding: 7px 14px;
190-
border-top: 1px solid #eee;
191-
text-align: right;
192-
background: #fafafa;
193-
}
194-
195-
.panel-cancel {
196-
color: #999;
197-
cursor: pointer;
198-
text-decoration: none;
199-
}
200-
201-
.panel-cancel:hover {
202-
color: #555;
203-
text-decoration: none;
204-
}
205-
206-
.panel-backdrop {
207-
position: fixed;
208-
top: 0;
209-
left: 0;
210-
right: 0;
211-
bottom: 0;
212-
z-index: 999;
213-
}
214-
</style>

0 commit comments

Comments
 (0)