Implement some router changes for v4
This commit is contained in:
parent
33b8a0d2f5
commit
2a32993c5c
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<nav class="topic-navigation">
|
||||
<router-link
|
||||
:to="{ name: 'topic', params: { topicSlug: topic.slug } }"
|
||||
:class="{ 'topic-navigation__topic--active': topic.active, 'book-subnavigation__item--mobile': mobile }"
|
||||
:to="{name: 'topic', params: {topicSlug: topic.slug}}"
|
||||
:class="{'topic-navigation__topic--active': topic.active, 'book-subnavigation__item--mobile': mobile}"
|
||||
tag="div"
|
||||
active-class="book-subnavigation__item--active"
|
||||
class="topic-navigation__topic book-subnavigation__item"
|
||||
|
|
@ -17,49 +17,49 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import ALL_TOPICS_QUERY from '@/graphql/gql/queries/allTopicsQuery.gql';
|
||||
import sidebarMixin from '@/mixins/sidebar';
|
||||
import ALL_TOPICS_QUERY from '@/graphql/gql/queries/allTopicsQuery.gql';
|
||||
import sidebarMixin from '@/mixins/sidebar';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
mobile: {
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
mixins: [sidebarMixin],
|
||||
|
||||
data() {
|
||||
return {
|
||||
topics: [],
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
topicId(id) {
|
||||
return atob(id);
|
||||
},
|
||||
},
|
||||
|
||||
apollo: {
|
||||
topics: {
|
||||
query: ALL_TOPICS_QUERY,
|
||||
manual: true,
|
||||
result({ data, loading }) {
|
||||
if (!loading) {
|
||||
this.topics = this.$getRidOfEdges(data).topics;
|
||||
}
|
||||
export default {
|
||||
props: {
|
||||
mobile: {
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
mixins: [sidebarMixin],
|
||||
|
||||
data() {
|
||||
return {
|
||||
topics: [],
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
topicId(id) {
|
||||
return atob(id);
|
||||
},
|
||||
},
|
||||
|
||||
apollo: {
|
||||
topics: {
|
||||
query: ALL_TOPICS_QUERY,
|
||||
manual: true,
|
||||
result({data, loading}) {
|
||||
if (!loading) {
|
||||
this.topics = this.$getRidOfEdges(data).topics;
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/_variables.scss';
|
||||
@import "~styles/helpers";
|
||||
|
||||
.topic-navigation {
|
||||
&__topic {
|
||||
.topic-navigation {
|
||||
&__topic {
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
<template>
|
||||
<router-link :to="moduleLink" :class="['module-teaser', { 'module-teaser--small': !teaser }]" tag="div">
|
||||
<div :style="{ backgroundImage: 'url(' + heroImage + ')' }" class="module-teaser__image" />
|
||||
<router-link
|
||||
:to="moduleLink"
|
||||
:class="['module-teaser', {'module-teaser--small': !teaser}]"
|
||||
tag="div"
|
||||
>
|
||||
<div
|
||||
:style="{backgroundImage: 'url('+heroImage+')'}"
|
||||
class="module-teaser__image"
|
||||
/>
|
||||
<div class="module-teaser__body">
|
||||
<h3 class="module-teaser__meta-title">
|
||||
{{ metaTitle }}
|
||||
|
|
@ -16,68 +23,72 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: ['metaTitle', 'title', 'teaser', 'id', 'slug', 'heroImage'],
|
||||
export default {
|
||||
props: ['metaTitle', 'title', 'teaser', 'id', 'slug', 'heroImage'],
|
||||
|
||||
computed: {
|
||||
moduleLink() {
|
||||
return {
|
||||
name: 'module',
|
||||
params: {
|
||||
slug: this.slug,
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
computed: {
|
||||
moduleLink() {
|
||||
if (this.slug) {
|
||||
return {
|
||||
name: 'module',
|
||||
params: {
|
||||
slug: this.slug
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '@/styles/_variables.scss';
|
||||
@import '@/styles/_mixins.scss';
|
||||
@import "@/styles/_variables.scss";
|
||||
@import "@/styles/_mixins.scss";
|
||||
|
||||
.module-teaser {
|
||||
box-shadow: 0 3px 9px 0 rgba(0, 0, 0, 0.12);
|
||||
border: 1px solid #e2e2e2;
|
||||
height: 330px;
|
||||
max-width: 380px;
|
||||
width: 100%;
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
|
||||
&--small {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
&__image {
|
||||
.module-teaser {
|
||||
box-shadow: 0 3px 9px 0 rgba(0, 0, 0, 0.12);
|
||||
border: 1px solid #E2E2E2;
|
||||
height: 330px;
|
||||
max-width: 380px;
|
||||
width: 100%;
|
||||
max-height: 150px;
|
||||
height: 150px;
|
||||
background-position: center;
|
||||
background-size: 100% auto;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
|
||||
&__body {
|
||||
padding: 20px;
|
||||
}
|
||||
&--small {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
&__meta-title {
|
||||
color: $color-silver-dark;
|
||||
margin-bottom: $large-spacing;
|
||||
@include regular-text;
|
||||
}
|
||||
&__image {
|
||||
width: 100%;
|
||||
max-height: 150px;
|
||||
height: 150px;
|
||||
background-position: center;
|
||||
background-size: 100% auto;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
&__title {
|
||||
@include heading-3;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
&__body {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
&__description {
|
||||
line-height: $default-line-height;
|
||||
font-size: 1.2rem;
|
||||
&__meta-title {
|
||||
color: $color-silver-dark;
|
||||
margin-bottom: $large-spacing;
|
||||
@include regular-text;
|
||||
}
|
||||
|
||||
&__title {
|
||||
@include heading-3;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
&__description {
|
||||
line-height: $default-line-height;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue