refactor: migrate Navigation component
This commit is contained in:
parent
c1b7bdbbb4
commit
267830b15d
1 changed files with 30 additions and 39 deletions
|
@ -1,52 +1,47 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { RouterLink } from "vue-router";
|
||||||
|
import router from "@/router";
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<nav class="nav">
|
<nav class="nav">
|
||||||
<ul class="nav__list flex flex--row flex--nowrap flex--center-v">
|
<ul class="nav__list">
|
||||||
<li class="nav__item" v-for="(route, idx) in routes" :key="idx">
|
<li
|
||||||
<router-link class="nav__link" :to="route.path">
|
class="nav__item"
|
||||||
|
v-for="(route, idx) in router.options.routes"
|
||||||
|
:key="idx"
|
||||||
|
>
|
||||||
|
<RouterLink class="nav__link" :to="route.path">
|
||||||
{{ route.name }}
|
{{ route.name }}
|
||||||
</router-link>
|
</RouterLink>
|
||||||
<div class="nav__underline"></div>
|
<div class="nav__underline"></div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
props: {
|
|
||||||
routes: {
|
|
||||||
required: true,
|
|
||||||
type: Array,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "@/scss/_variables.scss";
|
|
||||||
@import "@/scss/_mixins.scss";
|
|
||||||
|
|
||||||
.nav {
|
.nav {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
&__list {
|
&__list {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row nowrap;
|
||||||
|
justify-content: var(--navigation-justify-content);
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
|
||||||
z-index: 1;
|
|
||||||
|
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
@include mq-desktop {
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__item {
|
&__item {
|
||||||
padding: 0.375em;
|
padding: 0.375rem;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,28 +49,22 @@ export default {
|
||||||
display: block;
|
display: block;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
color: $copy-color;
|
color: var(--color-text);
|
||||||
margin-bottom: 0.375em;
|
margin-bottom: 0.375em;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
text-transform: capitalize;
|
||||||
|
|
||||||
&.router-link-exact-active {
|
&.router-link-exact-active {
|
||||||
color: #fff;
|
color: var(--color-text);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__link:hover ~ &__underline {
|
|
||||||
&:before,
|
|
||||||
&:after {
|
|
||||||
width: 50%;
|
|
||||||
background-color: $copy-color;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__link:hover ~ &__underline,
|
||||||
&__link.router-link-exact-active ~ &__underline {
|
&__link.router-link-exact-active ~ &__underline {
|
||||||
&:before,
|
&:before,
|
||||||
&:after {
|
&:after {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
background-color: #fff;
|
background-color: var(--color-text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,9 +77,11 @@ export default {
|
||||||
&:after {
|
&:after {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 0;
|
|
||||||
height: 0.125em;
|
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
||||||
|
width: 0;
|
||||||
|
height: 0.125rem;
|
||||||
|
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue