Commit ace6e2bc authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

Merge branch 'feature/navbar' into 'feature/deploy-to-aws'

update navbar style

See merge request !28
parents 06f32646 38c8085a
<template> <template>
<v-row
justify="center"
>
<v-dialog <v-dialog
v-model="dialog" v-model="dialog"
width="450px" width="450px"
...@@ -69,7 +66,6 @@ ...@@ -69,7 +66,6 @@
</v-icon> </v-icon>
</v-col> </v-col>
</v-dialog> </v-dialog>
</v-row>
</template> </template>
<script> <script>
......
...@@ -42,7 +42,5 @@ export default { ...@@ -42,7 +42,5 @@ export default {
</script> </script>
<style> <style>
.v-window__container {
margin-top: 20px;
}
</style> </style>
<template> <template>
<v-row justify="center">
<v-dialog <v-dialog
v-model="dialog" v-model="dialog"
width="450px" width="450px"
...@@ -90,7 +89,6 @@ ...@@ -90,7 +89,6 @@
</v-icon> </v-icon>
</v-col> </v-col>
</v-dialog> </v-dialog>
</v-row>
</template> </template>
<script> <script>
......
<template>
<ul class="dropdown-item">
<TreeNode v-for="(item, i) in categories" :key="i" :node="item" />
</ul>
</template>
<script>
import TreeNode from '~/components/user/TreeNode.vue'
export default {
name: 'CategoryTree',
components: {
TreeNode
},
props: {
categories: Object
},
data: () => ({
selectedItem: 1
})
}
</script>
<style>
.dropdown-item {
box-shadow: 0 2px 35px rgba(0,0,0,0.1);
}
li {
list-style: none;
line-height: 2rem;
padding: 0 1.5rem;
}
li span {
font-size: 15px;
}
li > ul {
position: absolute;
left: 100%;
box-shadow: 0 2px 35px rgba(0,0,0,0.1);
transition: transform 0.2s ease-out;
}
li:hover > ul {
transform: translate3d(0,0,0);
}
ul.dropdown-item {
padding: 10px 0;
}
</style>
<template> <template>
<v-container> <v-container class="navbar-container">
<div class="navbar d-flex justify-space-between "> <div class="navbar">
<div class="d-flex justify-space-between col-md-7"> <div class="navbar-left">
<div> <div class="navbar-item">
<span> <span>
Home Home
</span> </span>
</div> </div>
<div class="dropdown"> <div class="navbar-item dropdown">
<span> <span>
Products Products
</span> </span>
<v-icon>mdi-chevron-down</v-icon> <v-icon>mdi-chevron-down</v-icon>
<div class="dropdown-content elevation-10" :elevation="2"> <div class="dropdown-content" :elevation="2">
<v-treeview <CategoryTree :categories="categories" />
:active.sync="active"
rounded
dense
hoverable
activatable
:items="categories"
@update:active="setCategory(item)"
>
<template #label="{ item }">
<nuxt-link :to="`/home-page/categories/${item.id}`" tag="div">
{{ item.name }}
</nuxt-link>
</template>
</v-treeview>
</div> </div>
</div> </div>
<div> <div class="navbar-item">
<span> <span>
Pages Pages
</span> </span>
</div> </div>
<div> <div class="navbar-item">
<span> <span>
Blogs Blogs
</span> </span>
</div> </div>
<div> <div class="navbar-item">
<span> <span>
About About
</span> </span>
</div> </div>
</div> </div>
<div class="none-tag align-center "> <div class="d-flex align-center none-tag">
<v-icon>mdi-tag</v-icon> <v-icon>mdi-tag</v-icon>
<span class="mx-2"> <span class="mx-2">
Special offer! Special offer!
...@@ -62,8 +48,13 @@ ...@@ -62,8 +48,13 @@
<script> <script>
import { mapActions, mapState } from 'vuex' import { mapActions, mapState } from 'vuex'
import CategoryTree from '~/components/user/CategoryTree.vue'
export default { export default {
name: 'NavBar', name: 'NavBar',
components: {
CategoryTree
},
data: () => ({ data: () => ({
active: [], active: [],
open: [], open: [],
...@@ -111,6 +102,14 @@ export default { ...@@ -111,6 +102,14 @@ export default {
</script> </script>
<style scoped> <style scoped>
.navbar-container {
padding-left: 0;
padding-right: 0;
}
.navbar {
display: flex;
justify-content: space-between;
}
.navbar span { .navbar span {
font-weight: bold; font-weight: bold;
cursor: pointer; cursor: pointer;
...@@ -119,10 +118,21 @@ export default { ...@@ -119,10 +118,21 @@ export default {
.navbar span:hover { .navbar span:hover {
color: #26c; color: #26c;
} }
.navbar-left {
width: 50%;
display: flex;
justify-content: space-between;
padding-left: 0;
padding-right: 0;
}
.dropdown { .dropdown {
position: relative; position: relative;
} }
.dropdown span {
font-size: 15px;
}
.dropdown:hover .dropdown-content { .dropdown:hover .dropdown-content {
transition: 0.3s;
display: block; display: block;
} }
.dropdown-content { .dropdown-content {
...@@ -130,8 +140,7 @@ export default { ...@@ -130,8 +140,7 @@ export default {
position: absolute; position: absolute;
z-index: 1; z-index: 1;
background-color: #ffffff; background-color: #ffffff;
min-width: 350px; min-width: 250px;
/* margin-top: 20px; */
} }
.none-tag { .none-tag {
display: flex; display: flex;
......
<template>
<li class="dropdown">
<nuxt-link class="label" :to="`/home-page/categories/${node.id}`" tag="span">
{{ node.name }}
</nuxt-link>
<ul v-if="node.children && node.children.length" class="dropdown-item">
<TreeNode v-for="child in node.children" :key="child.id" :node="child" />
</ul>
</li>
</template>
<script>
export default {
name: 'TreeNode',
props: {
node: Object
}
}
</script>
<style scoped>
.dropdown {
position: relative;
cursor: pointer;
}
.dropdown-item {
display: none;
}
.dropdown:hover > .dropdown-item {
display: block;
}
.dropdown-item {
display: none;
position: absolute;
z-index: 1;
background-color: #ffffff;
min-width: 250px;
top: -10px;
}
li:hover > span {
color: #2266cc;
}
</style>
...@@ -48,16 +48,12 @@ ...@@ -48,16 +48,12 @@
</v-app> </v-app>
</template> </template>
<script> <script>
export default {
// eslint-disable-next-line no-undef
components: { NuxtLogo }
}
</script>
<script>
import { validationMixin } from 'vuelidate' import { validationMixin } from 'vuelidate'
import { required, minLength, email } from 'vuelidate/lib/validators' import { required, minLength, email } from 'vuelidate/lib/validators'
import { NuxtLogo } from '@/components/NuxtLogo.vue'
export default { export default {
components: { NuxtLogo },
dark: false, dark: false,
mixins: [validationMixin], mixins: [validationMixin],
layout: 'empty', layout: 'empty',
...@@ -124,14 +120,14 @@ export default { ...@@ -124,14 +120,14 @@ export default {
this.$auth.$storage.setUniversal('loggedIn', 'true') this.$auth.$storage.setUniversal('loggedIn', 'true')
if (resp.status === 200) { if (resp.status === 200) {
this.$toast.success('Successfully authenticated', { this.$toast.success('Successfully authenticated', {
duration: 2000, duration: 2000
}); })
this.$router.push('home'); this.$router.push('home')
} }
} catch (e) { } catch (e) {
this.$toast.error('Username or Password not valid', { this.$toast.error('Username or Password not valid', {
duration: 2000 duration: 2000
}); })
this.$router.push('/login') this.$router.push('/login')
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment