skillbox/client/src/components/modules/ModuleSubNavigation.vue

103 lines
1.9 KiB
Vue

<template>
<nav class="module-sub-navigation sub-navigation">
<back-link
:title="module.title"
data-cy="back-link"
type="module"
/>
</nav>
</template>
<script setup lang="ts">
import BackLink from '@/components/BackLink.vue';
import { useQuery } from '@vue/apollo-composable';
import { useRoute } from 'vue-router';
import { computed } from 'vue';
import { graphql } from '@/__generated__';
const route = useRoute();
const { result } = useQuery(
graphql(`
query ModuleTitleQuery($slug: String) {
module(slug: $slug) {
title
}
}
`),
{
slug: route.params.slug as string,
}
);
const module = computed(() => result.value?.module || { title: '' });
</script>
<style scoped lang="scss">
@import 'styles/helpers';
@mixin module-navigation-typography {
font-family: $sans-serif-font-family;
color: $color-silver-dark;
font-weight: $font-weight-regular;
}
.module-sub-navigation {
display: none;
width: 100%;
box-sizing: border-box;
z-index: 11;
background-color: $color-white;
border-top: 1px solid $color-silver;
&__topic-link {
@include regular-text;
}
@include desktop {
display: flex;
}
&__module-content {
margin-bottom: 18px;
}
&__heading {
@include module-navigation-typography;
margin: 0;
font-size: 1.0625rem;
cursor: pointer;
}
&__anchors {
display: flex;
flex-direction: column;
padding: 16px 24px 0;
}
&__anchor {
@include module-navigation-typography;
font-size: 0.875rem;
line-height: 1.2rem;
margin-bottom: 0.6875rem;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
&--active {
color: $color-brand;
}
}
&__toggle-menu {
margin-left: auto;
display: flex;
align-items: center;
}
&__actions {
@include regular-text;
margin-right: $medium-spacing;
}
}
</style>