1
0
Fork 0
mirror of https://github.com/em-squared/5e-drs.git synced 2025-10-30 13:14:20 +00:00
5e-drs/docs/.vuepress/theme/components/PageToc.vue
2020-04-16 18:08:21 +02:00

79 lines
1.1 KiB
Vue

<template>
<div class="page-toc mt-4">
<p class="subtitle-2 pl-6 pr-6">Table des matières</p>
<ul>
<li :class="[ itemPadding(h), 'mb-1' ]" v-for="h in headers">
<a :href="anchor(h)">{{ h.title }}</a>
</li>
</ul>
</div>
</template>
<script>
export default {
name: 'PageToc',
data () {
return {
}
},
computed: {
headers () {
return this.$page.headers
}
},
methods: {
anchor (h) {
return '#' + h.slug
},
itemPadding (h) {
return 'pl-' + (h.level - 2) * 4
}
},
mounted () {
}
}
</script>
<style lang="scss">
@import '../styles/colors';
.page-toc {
ul {
list-style: none;
padding-right: 24px;
li {
a {
color: $color-gray;
text-decoration: none;
&:hover {
color: $color-dragon;
}
}
}
}
}
.theme--dark {
.page-toc {
ul {
li {
a {
color: lighten($color-gray, 20);
&:hover {
color: lighten($color-dragon, 15);
}
}
}
}
}
}
</style>