-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
Copy pathgithub.vue
268 lines (241 loc) · 8.06 KB
/
github.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<template>
<q-layout class="bg-grey-1">
<q-header elevated class="text-white" style="background: #24292e" height-hint="61.59">
<q-toolbar class="q-py-sm q-px-md">
<q-btn round dense flat :ripple="false" :icon="fabGithub" size="19px" color="white" class="q-mr-sm" no-caps />
<q-select
ref="search" dark dense standout use-input hide-selected
class="GL__toolbar-select"
color="black" :stack-label="false" label="Search or jump to..."
v-model="text" :options="filteredOptions" @filter="filter"
style="width: 300px"
>
<template v-slot:append>
<img src="https://cdn.quasar.dev/img/layout-gallery/img-github-search-key-slash.svg">
</template>
<template v-slot:no-option>
<q-item>
<q-item-section>
<div class="text-center">
<q-spinner-pie
color="grey-5"
size="24px"
/>
</div>
</q-item-section>
</q-item>
</template>
<template v-slot:option="scope">
<q-item
v-bind="scope.itemProps"
class="GL__select-GL__menu-link"
>
<q-item-section side>
<q-icon name="collections_bookmark" />
</q-item-section>
<q-item-section>
<q-item-label v-html="scope.opt.label" />
</q-item-section>
<q-item-section side :class="{ 'default-type': !scope.opt.type }">
<q-btn outline dense no-caps text-color="blue-grey-5" size="12px" class="bg-grey-1 q-px-sm">
{{ scope.opt.type || 'Jump to' }}
<q-icon name="subdirectory_arrow_left" size="14px" />
</q-btn>
</q-item-section>
</q-item>
</template>
</q-select>
<div v-if="$q.screen.gt.sm" class="GL__toolbar-link q-ml-xs q-gutter-md text-body2 text-weight-bold row items-center no-wrap">
<a href="javascript:void(0)" class="text-white">
Pull requests
</a>
<a href="javascript:void(0)" class="text-white">
Issues
</a>
<a href="javascript:void(0)" class="text-white">
Marketplace
</a>
<a href="javascript:void(0)" class="text-white">
Explore
</a>
</div>
<q-space />
<div class="q-pl-sm q-gutter-sm row items-center no-wrap">
<q-btn v-if="$q.screen.gt.xs" dense flat round size="sm" icon="notifications" />
<q-btn v-if="$q.screen.gt.xs" dense flat>
<div class="row items-center no-wrap">
<q-icon name="add" size="20px" />
<q-icon name="arrow_drop_down" size="16px" style="margin-left: -2px" />
</div>
<q-menu auto-close>
<q-list dense style="min-width: 100px">
<q-item clickable class="GL__menu-link">
<q-item-section>New repository</q-item-section>
</q-item>
<q-item clickable class="GL__menu-link">
<q-item-section>Import repository</q-item-section>
</q-item>
<q-item clickable class="GL__menu-link">
<q-item-section>New gist</q-item-section>
</q-item>
<q-item clickable class="GL__menu-link">
<q-item-section>New organization</q-item-section>
</q-item>
<q-separator />
<q-item-label header>This repository</q-item-label>
<q-item clickable class="GL__menu-link">
<q-item-section>New issue</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
<q-btn dense flat no-wrap>
<q-avatar rounded size="20px">
<img src="https://cdn.quasar.dev/img/avatar3.jpg">
</q-avatar>
<q-icon name="arrow_drop_down" size="16px" />
<q-menu auto-close>
<q-list dense>
<q-item class="GL__menu-link-signed-in">
<q-item-section>
<div>Signed in as <strong>Mary</strong></div>
</q-item-section>
</q-item>
<q-separator />
<q-item clickable class="GL__menu-link-status">
<q-item-section>
<div>
<q-icon name="tag_faces" color="blue-9" size="18px" />
Set your status
</div>
</q-item-section>
</q-item>
<q-separator />
<q-item clickable class="GL__menu-link">
<q-item-section>Your profile</q-item-section>
</q-item>
<q-item clickable class="GL__menu-link">
<q-item-section>Your repositories</q-item-section>
</q-item>
<q-item clickable class="GL__menu-link">
<q-item-section>Your projects</q-item-section>
</q-item>
<q-item clickable class="GL__menu-link">
<q-item-section>Your stars</q-item-section>
</q-item>
<q-item clickable class="GL__menu-link">
<q-item-section>Your gists</q-item-section>
</q-item>
<q-separator />
<q-item clickable class="GL__menu-link">
<q-item-section>Help</q-item-section>
</q-item>
<q-item clickable class="GL__menu-link">
<q-item-section>Settings</q-item-section>
</q-item>
<q-item clickable class="GL__menu-link">
<q-item-section>Sign out</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</div>
</q-toolbar>
</q-header>
<q-page-container>
<router-view />
</q-page-container>
</q-layout>
</template>
<script>
import { ref } from 'vue'
import { fabGithub } from '@quasar/extras/fontawesome-v6'
const stringOptions = [
'quasarframework/quasar',
'quasarframework/quasar-awesome'
]
export default {
name: 'MyLayout',
setup () {
const text = ref('')
const options = ref(null)
const filteredOptions = ref([])
const search = ref(null) // $refs.search
function filter (val, update) {
if (options.value === null) {
// load data
setTimeout(() => {
options.value = stringOptions
search.value.filter('')
}, 2000)
update()
return
}
if (val === '') {
update(() => {
filteredOptions.value = options.value.map(op => ({ label: op }))
})
return
}
update(() => {
filteredOptions.value = [
{
label: val,
type: 'In this repository'
},
{
label: val,
type: 'All GitHub'
},
...options.value
.filter(op => op.toLowerCase().includes(val.toLowerCase()))
.map(op => ({ label: op }))
]
})
}
return {
fabGithub,
text,
options,
filteredOptions,
search,
filter
}
}
}
</script>
<style lang="sass">
.GL
&__select-GL__menu-link
.default-type
visibility: hidden
&:hover
background: #0366d6
color: white
.q-item__section--side
color: white
.default-type
visibility: visible
&__toolbar-link
a
color: white
text-decoration: none
&:hover
opacity: 0.7
&__menu-link:hover
background: #0366d6
color: white
&__menu-link-signed-in,
&__menu-link-status
&:hover
& > div
background: white !important
&__menu-link-status
color: $blue-grey-6
&:hover
color: $light-blue-9
&__toolbar-select.q-field--focused
width: 450px !important
.q-field__append
display: none
</style>