diff options
author | Bastien Wirtz <bastien.wirtz@gmail.com> | 2020-05-25 15:07:03 -0700 |
---|---|---|
committer | Bastien Wirtz <bastien.wirtz@gmail.com> | 2020-05-25 15:07:03 -0700 |
commit | b9c5fcf085bed9c6100283133531b36bfbb06cf0 (patch) | |
tree | 7baa4d16c9d6c06745727c7c273065a29b8fc1d7 /src/components/Navbar.vue | |
parent | ab7ac44c191e3b7dea696e76b74097e23f73b18c (diff) | |
download | homer-b9c5fcf085bed9c6100283133531b36bfbb06cf0.tar.gz homer-b9c5fcf085bed9c6100283133531b36bfbb06cf0.tar.zst homer-b9c5fcf085bed9c6100283133531b36bfbb06cf0.zip |
Build system integration using vue-cli.
Diffstat (limited to 'src/components/Navbar.vue')
-rw-r--r-- | src/components/Navbar.vue | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue new file mode 100644 index 0000000..a64ff3b --- /dev/null +++ b/src/components/Navbar.vue | |||
@@ -0,0 +1,66 @@ | |||
1 | <template> | ||
2 | <div v-cloak v-if="links" class="container-fluid"> | ||
3 | <nav class="navbar" role="navigation" aria-label="main navigation"> | ||
4 | <div class="container"> | ||
5 | <div class="navbar-brand"> | ||
6 | <a | ||
7 | role="button" | ||
8 | aria-label="menu" | ||
9 | aria-expanded="false" | ||
10 | class="navbar-burger" | ||
11 | :class="{ 'is-active': showMenu }" | ||
12 | v-on:click="$emit('navbar:toggle')" | ||
13 | > | ||
14 | <span aria-hidden="true"></span> | ||
15 | <span aria-hidden="true"></span> | ||
16 | <span aria-hidden="true"></span> | ||
17 | </a> | ||
18 | </div> | ||
19 | <div class="navbar-menu" :class="{ 'is-active': showMenu }"> | ||
20 | <div class="navbar-start"> | ||
21 | <a | ||
22 | class="navbar-item" | ||
23 | v-for="link in links" | ||
24 | :key="link.url" | ||
25 | :href="link.url" | ||
26 | :target="link.target" | ||
27 | > | ||
28 | <i | ||
29 | v-if="link.icon" | ||
30 | style="margin-right: 6px;" | ||
31 | :class="link.icon" | ||
32 | ></i> | ||
33 | {{ link.name }} | ||
34 | </a> | ||
35 | </div> | ||
36 | <div class="navbar-end"> | ||
37 | <slot></slot> | ||
38 | </div> | ||
39 | </div> | ||
40 | </div> | ||
41 | </nav> | ||
42 | </div> | ||
43 | </template> | ||
44 | |||
45 | <script> | ||
46 | export default { | ||
47 | name: "Navbar", | ||
48 | props: { | ||
49 | open: { | ||
50 | type: Boolean, | ||
51 | default: false, | ||
52 | }, | ||
53 | links: Array, | ||
54 | }, | ||
55 | computed: { | ||
56 | showMenu: function () { | ||
57 | return this.open && this.isSmallScreen(); | ||
58 | }, | ||
59 | }, | ||
60 | methods: { | ||
61 | isSmallScreen: function () { | ||
62 | return window.matchMedia("screen and (max-width: 1023px)").matches; | ||
63 | }, | ||
64 | }, | ||
65 | }; | ||
66 | </script> | ||