diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2019-08-12 13:02:15 +0200 |
---|---|---|
committer | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2019-08-12 13:02:15 +0200 |
commit | 1e15172a7dfe5baf20225786c1ea06af0d3e691c (patch) | |
tree | ebeb382aa8dd88e67604373f83171a8722b1a6e2 /src/components | |
parent | a163ec2d7497acb51612669a83e31e37746c176f (diff) | |
download | puszcza-1e15172a7dfe5baf20225786c1ea06af0d3e691c.tar.gz puszcza-1e15172a7dfe5baf20225786c1ea06af0d3e691c.zip |
Add basic responsiveness to NavBar
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/NavBar.vue | 66 | ||||
-rw-r--r-- | src/components/NavLink.vue | 8 |
2 files changed, 69 insertions, 5 deletions
diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index 2486933..c48dced 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -1,9 +1,11 @@ <template> <nav class="navbar"> <div class="title"> - <NavLink link="/" name="19 PDH Puszcza"></NavLink> + <img class="logo" src="../assets/krajka-logo.svg" /> + <NavLink class="title-name" link="/" name="19 PDH Puszcza"></NavLink> </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> @@ -29,20 +31,30 @@ export default { data: function() { return { routes, - externalRoutes + externalRoutes, + 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; } @@ -53,12 +65,58 @@ export default { .title { font-size: 30px; - margin-left: 200px; flex-shrink: 0; + + display: flex; +} + +.title-name { + margin-left: 120px; } .links { display: flex; - margin-right: 200px; + 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> \ No newline at end of file diff --git a/src/components/NavLink.vue b/src/components/NavLink.vue index 7ad5088..5dbf609 100644 --- a/src/components/NavLink.vue +++ b/src/components/NavLink.vue @@ -1,6 +1,6 @@ <template> <li class="navlink"> - <a v-if="external" class="link" :href="link">{{name}}</a> + <a v-if="external" class="link" target="_blank" :href="link">{{name}}</a> <router-link v-else class="link" :to="link">{{ name }}</router-link> </li> </template> @@ -27,4 +27,10 @@ export default { padding: 10px; margin: 10px; } + +@media (max-width: 1300px) { + .navlink { + margin: 0; + } +} </style> \ No newline at end of file |