about summary refs log tree commit diff
path: root/src/components/NavBar.vue
blob: 0cae182f24a534fe1d94e54d3f06a3a7c0501239 (plain)
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
<template>
  <nav class="navbar">
    <div class="title">
      <img class="logo" :src="logoPath" />
      <router-link class="title-name" to="/">{{ title }}</router-link>
    </div>
    <div class="space"></div>
    <button @click="toggleMenu" class="menu-toggler">Menu</button>
    <div class="links">
      <!-- Loop for generating links -->
      <NavLink v-for="route in routes" :key="route.path" :link="route.path" :name="route.name"></NavLink>
      <NavLink
        v-for="route in externalRoutes"
        :key="route.path"
        :link="route.path"
        :name="route.name"
        :external="true"
      ></NavLink>
    </div>
  </nav>
</template>

<script>
import NavLink from "./NavLink.vue";

export default {
  components: {
    NavLink
  },
  props: {
    routes: Array,
    externalRoutes: Array,
    title: String,
    logoPath: String
  },
  data: function() {
    return {
      menuCollapsed: true
    };
  },
  methods: {
    toggleMenu() {
      console.log("a");
      this.menuCollapsed = !this.menuCollapsed;
    }
  }
};
</script>

<style scoped>
.navbar {
  box-sizing: border-box;
  width: 100vw;
  height: 80px;

  background: #ffffff;
  box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.1);

  padding: 0 200px 0 200px;

  display: flex;
  align-items: center;
}

.space {
  flex: 1;
}

.title {
  font-size: 30px;
  flex-shrink: 0;

  display: flex;
}

.title-name {
  margin-left: 120px;
  text-decoration: none;
  color: #181818;
  padding: 10px;
}

.links {
  display: flex;
  flex-direction: row;
}

.logo {
  position: absolute;
  top: 0;
}

.menu-toggler {
  display: none;
}

.show {
  display: block !important;
}

@media (max-width: 1300px) {
  .navbar {
    padding: 0 50px 0 50px;
  }
}

@media (max-width: 900px) {
  .title {
    font-size: 24px;
  }

  .links {
    background-color: #ffffff;

    position: absolute;
    /* width: 100vw; */

    margin-top: 80px;

    flex-direction: column;
    display: none;
  }

  .menu-toggler {
    display: block;
  }
}
</style>