This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 196
/
NavSection.vue
89 lines (81 loc) · 2.49 KB
/
NavSection.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
<template>
<nav class="navbar small">
<div class="navbar-brand">
<a class="logo" href="/">
<img alt="Logo" src="/static/logos/products/search.svg">
</a>
<a role="button"
:class="{ ['navbar-burger']: true, ['is-active']: isBurgerMenuActive }"
aria-label="menu"
aria-expanded="false"
@click="toggleBurgerActive">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div :class="{ ['navbar-menu']: true, ['is-active']: isBurgerMenuActive }">
<div class="margin-left-big" v-if="showNavSearch ==='true'">
<form class="hero_search-form"
role="search"
method="post"
v-on:submit.prevent="onSubmit">
<input class="input"
type="search"
:placeholder="navSearchPlaceholder"
v-model.lazy="form.searchTerm">
<div class="is-sr-only">
<button type="submit" class="button secondary" value="Search"></button>
</div>
</form>
</div>
<div class="navbar-end">
<a class="navbar-item" href="/about">{{$t('header.about')}}</a>
<a class="navbar-item" href="/collections">{{$t('header.collections')}}</a>
<a class="navbar-item" href="/search-help">{{$t('header.search-guide')}}</a>
<a class="navbar-item" href="/feedback">{{$t('header.feedback')}}</a>
<a class="navbar-item" href="https://opensource.creativecommons.org/ccsearch-browser-extension/" target="_blank">
{{$t('header.extension')}}
<i class="icon external-link" />
</a>
</div>
</div>
</nav>
</template>
<script>
import { SET_QUERY } from '@/store/mutation-types';
export default {
props: {
showNavSearch: {
default: false,
},
navSearchPlaceholder: {
default: 'Search all images',
},
},
name: 'nav-section',
data: () => ({ form: { searchTerm: '' }, isBurgerMenuActive: false }),
methods: {
onSubmit() {
this.$store.commit(SET_QUERY, { query: { q: this.form.searchTerm }, shouldNavigate: true });
},
toggleBurgerActive() {
this.isBurgerMenuActive = !this.isBurgerMenuActive;
},
},
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
/* header */
.logo > img {
height: 42px;
padding-right: 11px;
}
.hero_search-form {
margin: 0 15px;
input {
width: 16rem;
}
}
</style>