This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Zaimki/components/Header.vue

83 lines
2.7 KiB
Vue
Raw Normal View History

2020-09-11 03:17:29 -07:00
<template>
2020-09-23 11:34:35 -07:00
<header class="mb-4">
<h1 class="mb-3">
2020-09-11 03:17:29 -07:00
<nuxt-link to="/">
<Icon v="tags"/>
Zaimki.pl
</nuxt-link>
</h1>
2020-09-23 11:34:35 -07:00
<div class="d-block d-md-none">
<div class="btn-group-vertical btn-block nav-custom mb-2">
2020-09-23 12:34:37 -07:00
<nuxt-link v-for="link in links" :key="link.link" :to="link.link" :class="`btn btn-sm ${isActiveRoute(link) ? 'active' : ''}`">
2020-09-23 11:34:35 -07:00
<Icon :v="link.icon"/>
{{ link.textLong || link.text }}
</nuxt-link>
</div>
</div>
<div class="d-none d-md-block">
<div class="btn-group btn-block nav-custom mb-2">
2020-09-23 12:34:37 -07:00
<nuxt-link v-for="link in links" :key="link.link" :to="link.link" :class="`btn btn-sm ${isActiveRoute(link) ? 'active' : ''}`">
2020-09-23 11:34:35 -07:00
<Icon :v="link.icon"/>
{{ link.text }}
</nuxt-link>
</div>
</div>
2020-09-11 03:17:29 -07:00
</header>
</template>
<script>
export default {
2020-09-23 11:34:35 -07:00
data() {
return {
links: [
2020-09-23 13:21:40 -07:00
{ link: '/', icon: 'home', text: 'Zaimki', textLong: 'Lista zaimków', extra: ['all', 'dowolne'] },
2020-09-23 11:34:35 -07:00
{ link: '/literatura', icon: 'books', text: 'Teksty kultury', textLong: 'Przykłady z tekstów kultury' },
{ link: '/neutratywy', icon: 'atom-alt', text: 'Neutratywy', textLong: 'Słownik neutratywów' },
2020-09-23 12:16:56 -07:00
{ link: '/kontakt', icon: 'comment-alt-smile', text: 'Kontakt' },
2020-09-23 11:34:35 -07:00
],
};
},
methods: {
isActiveRoute(link) {
return this.$route.path === link.link || (link.extra || []).includes(this.$route.name);
},
},
2020-09-11 03:17:29 -07:00
}
</script>
2020-09-23 11:34:35 -07:00
<style lang="scss" scoped>
@import "assets/style";
@include media-breakpoint-down('sm', $grid-breakpoints) {
.nav-custom {
.btn {
border-left: 1px solid $gray-500;
border-radius: 0;
&:hover, &:focus, &.active {
border-left: 3px solid $primary;
padding-left: calc(#{$btn-padding-x-sm} - 2px);
color: $primary;
}
text-align: left;
}
}
}
@include media-breakpoint-up('md', $grid-breakpoints) {
.nav-custom {
.btn {
border-bottom: 1px solid $gray-500;
border-radius: 0;
&:hover, &:focus, &.active {
border-bottom: 3px solid $primary;
padding-bottom: calc(#{$btn-padding-y-sm} - 2px);
color: $primary;
}
}
}
};
</style>