Timothy Gerla 688efabb93 fix: clean up docs page scripts in preparation for 0.5 docs
- simplify the docs page handling logic and get more nuxt-like
- the handleClick function was vestigial and didn't do anything anymore, remove it
- simplify the Vuex state quite a bit, remove activeDocPath
- clean up github link generation code, and fix #2076

Signed-off-by: Timothy Gerla <tim@gerla.net>
2020-05-02 02:49:19 -07:00

74 lines
1.7 KiB
Vue

<template>
<div class="sidenav sticky py-4">
<div class="sidebar-heading mb-4">Documentation</div>
<ul>
<li v-for="entry in $store.state.sidebar.menu" :key="entry.title">
<span class="sidebar-category pt-4">{{ entry.title }}</span>
<ul class="pt-1 pb-2">
<li
v-for="item in entry.items"
:key="item.path"
class="sidebar-item my-2"
>
<div v-if="item.children" class="ml-4 pt-2 sidebar-subcategory">
{{ item.title }}
</div>
<nuxt-link v-else :to="'#' + item.path" class="block ml-2">
<span class="p-2">{{ item.title }}</span>
</nuxt-link>
<ul v-if="item.children" class="sidebar-children ml-4 mt-2">
<li
v-for="child in item.children"
:key="child.path"
class="sidebar-item my-2"
>
<nuxt-link :to="'#' + child.path" class="block m-1">
<span class="p-2">{{ child.title }}</span>
</nuxt-link>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</template>
<script>
export default {
name: 'Sidebar'
}
</script>
<style>
.sidenav {
top: 7%;
@apply font-sans tracking-wide;
}
.sidebar-heading {
@apply font-headings text-gray-800 relative block text-2xl;
}
.sidebar-category {
@apply text-gray-500 text-base font-bold uppercase;
}
.sidebar-item {
@apply text-gray-700 text-base text-sm;
}
.sidebar-subcategory {
@apply uppercase text-gray-500 font-bold;
}
a:hover {
@apply text-gray-900 font-bold;
}
.nuxt-link-active {
@apply bg-primary-color-100 rounded-md text-gray-800;
}
</style>