-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
Copy pathgoogle-news.vue
272 lines (238 loc) · 8.2 KB
/
google-news.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
269
270
271
272
<template>
<q-layout view="hHh lpR fFf" class="bg-grey-1">
<q-header elevated class="bg-white text-grey-8" height-hint="64">
<q-toolbar class="GNL__toolbar">
<q-btn
flat
dense
round
@click="toggleLeftDrawer"
aria-label="Menu"
icon="menu"
class="q-mr-sm"
/>
<q-toolbar-title v-if="$q.screen.gt.xs" shrink class="row items-center no-wrap">
<img src="https://cdn.quasar.dev/img/layout-gallery/logo-google.svg">
<span class="q-ml-sm">News</span>
</q-toolbar-title>
<q-space />
<q-input class="GNL__toolbar-input" outlined dense v-model="search" color="bg-grey-7 shadow-1" placeholder="Search for topics, locations & sources">
<template v-slot:prepend>
<q-icon v-if="search === ''" name="search" />
<q-icon v-else name="clear" class="cursor-pointer" @click="search = ''" />
</template>
<template v-slot:append>
<q-btn
flat
dense
round
aria-label="Menu"
icon="arrow_drop_down"
>
<q-menu anchor="bottom end" self="top end">
<div class="q-pa-md" style="width: 400px">
<div class="text-body2 text-grey q-mb-md">
Narrow your search results
</div>
<div class="row items-center">
<div class="col-3 text-subtitle2 text-grey">
Exact phrase
</div>
<div class="col-9 q-pl-md">
<q-input dense v-model="exactPhrase" />
</div>
<div class="col-3 text-subtitle2 text-grey">
Has words
</div>
<div class="col-9 q-pl-md">
<q-input dense v-model="hasWords" />
</div>
<div class="col-3 text-subtitle2 text-grey">
Exclude words
</div>
<div class="col-9 q-pl-md">
<q-input dense v-model="excludeWords" />
</div>
<div class="col-3 text-subtitle2 text-grey">
Website
</div>
<div class="col-9 q-pl-md">
<q-input dense v-model="byWebsite" />
</div>
<div class="col-12 q-pt-lg row justify-end">
<q-btn flat dense no-caps color="grey-7" size="md" style="min-width: 68px;" label="Search" v-close-popup />
<q-btn flat dense no-caps color="grey-7" size="md" style="min-width: 68px;" @click="onClear" label="Clear" v-close-popup />
</div>
</div>
</div>
</q-menu>
</q-btn>
</template>
</q-input>
<q-space />
<div class="q-gutter-sm row items-center no-wrap">
<q-btn v-if="$q.screen.gt.sm" round dense flat color="text-grey-7" icon="apps">
<q-tooltip>Google Apps</q-tooltip>
</q-btn>
<q-btn round dense flat color="grey-8" icon="notifications">
<q-badge color="red" text-color="white" floating>
2
</q-badge>
<q-tooltip>Notifications</q-tooltip>
</q-btn>
<q-btn round flat>
<q-avatar size="26px">
<img src="https://cdn.quasar.dev/img/boy-avatar.png">
</q-avatar>
<q-tooltip>Account</q-tooltip>
</q-btn>
</div>
</q-toolbar>
</q-header>
<q-drawer
v-model="leftDrawerOpen"
show-if-above
bordered
class="bg-white"
:width="280"
>
<q-scroll-area class="fit">
<q-list padding class="text-grey-8">
<q-item class="GNL__drawer-item" v-ripple v-for="link in links1" :key="link.text" clickable>
<q-item-section avatar>
<q-icon :name="link.icon" />
</q-item-section>
<q-item-section>
<q-item-label>{{ link.text }}</q-item-label>
</q-item-section>
</q-item>
<q-separator inset class="q-my-sm" />
<q-item class="GNL__drawer-item" v-ripple v-for="link in links2" :key="link.text" clickable>
<q-item-section avatar>
<q-icon :name="link.icon" />
</q-item-section>
<q-item-section>
<q-item-label>{{ link.text }}</q-item-label>
</q-item-section>
</q-item>
<q-separator inset class="q-my-sm" />
<q-item class="GNL__drawer-item" v-ripple v-for="link in links3" :key="link.text" clickable>
<q-item-section>
<q-item-label>{{ link.text }} <q-icon v-if="link.icon" :name="link.icon" /></q-item-label>
</q-item-section>
</q-item>
<div class="q-mt-md">
<div class="flex flex-center q-gutter-xs">
<a class="GNL__drawer-footer-link" href="javascript:void(0)" aria-label="Privacy">Privacy</a>
<span> · </span>
<a class="GNL__drawer-footer-link" href="javascript:void(0)" aria-label="Terms">Terms</a>
<span> · </span>
<a class="GNL__drawer-footer-link" href="javascript:void(0)" aria-label="About">About Google</a>
</div>
</div>
</q-list>
</q-scroll-area>
</q-drawer>
<q-page-container>
<router-view />
</q-page-container>
</q-layout>
</template>
<script>
import { ref } from 'vue'
import { fasEarthAmericas, fasFlask } from '@quasar/extras/fontawesome-v6'
export default {
name: 'GoogleNewsLayout',
setup () {
const leftDrawerOpen = ref(false)
const search = ref('')
const showAdvanced = ref(false)
const showDateOptions = ref(false)
const exactPhrase = ref('')
const hasWords = ref('')
const excludeWords = ref('')
const byWebsite = ref('')
const byDate = ref('Any time')
function onClear () {
exactPhrase.value = ''
hasWords.value = ''
excludeWords.value = ''
byWebsite.value = ''
byDate.value = 'Any time'
}
function changeDate (option) {
byDate.value = option
showDateOptions.value = false
}
function toggleLeftDrawer () {
leftDrawerOpen.value = !leftDrawerOpen.value
}
return {
leftDrawerOpen,
search,
showAdvanced,
showDateOptions,
exactPhrase,
hasWords,
excludeWords,
byWebsite,
byDate,
links1: [
{ icon: 'web', text: 'Top stories' },
{ icon: 'person', text: 'For you' },
{ icon: 'star_border', text: 'Favourites' },
{ icon: 'search', text: 'Saved searches' }
],
links2: [
{ icon: 'flag', text: 'Canada' },
{ icon: fasEarthAmericas, text: 'World' },
{ icon: 'place', text: 'Local' },
{ icon: 'domain', text: 'Business' },
{ icon: 'memory', text: 'Technology' },
{ icon: 'local_movies', text: 'Entertainment' },
{ icon: 'directions_bike', text: 'Sports' },
{ icon: fasFlask, text: 'Science' },
{ icon: 'fitness_center', text: 'Health ' }
],
links3: [
{ icon: '', text: 'Language & region' },
{ icon: '', text: 'Settings' },
{ icon: 'open_in_new', text: 'Get the Android app' },
{ icon: 'open_in_new', text: 'Get the iOS app' },
{ icon: '', text: 'Send feedback' },
{ icon: 'open_in_new', text: 'Help' }
],
onClear,
changeDate,
toggleLeftDrawer
}
}
}
</script>
<style lang="sass">
.GNL
&__toolbar
height: 64px
&__toolbar-input
width: 55%
&__drawer-item
line-height: 24px
border-radius: 0 24px 24px 0
margin-right: 12px
.q-item__section--avatar
.q-icon
color: #5f6368
.q-item__label
color: #3c4043
letter-spacing: .01785714em
font-size: .875rem
font-weight: 500
line-height: 1.25rem
&__drawer-footer-link
color: inherit
text-decoration: none
font-weight: 500
font-size: .75rem
&:hover
color: #000
</style>