Skip to content

docs: add video courses link to nav #460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions nuxtjs.org/components/HeaderNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
<div class="relative w-full h-full flex items-center justify-center">
<ul class="flex space-x-12 h-full">
<li
v-for="(link, index) in headerLinks"
v-for="link in headerLinks"
:key="link.slug"
class="relative capitalize font-medium flex flex-col items-center justify-center space-y-1 text-center"
@mouseover="hoverLinks(index)"
@mouseleave="hover = false"
>
<NuxtLink
:to="`/${link.slug}/${link.slug.includes('blog') ? '' : link.children[0].slug || ''}`"
Expand All @@ -18,21 +16,29 @@
{{ link.title }}
</NuxtLink>
</li>
<li class="relative capitalize font-medium flex flex-col items-center justify-center space-y-1 text-center">
<a
href="https://masteringnuxt.com/?utm_source=nuxt&utm_medium=link&utm_campaign=navbar_link"
class="hover:d-primary-text-hover"
target="_blank"
rel="noopener"
>
Video Courses
</a>
</li>
</ul>
</div>
</template>

<script>
import { computed, defineComponent, useRoute, ref, useContext } from '@nuxtjs/composition-api'
import { computed, defineComponent, useRoute, useContext } from '@nuxtjs/composition-api'

export default defineComponent({
setup() {
// @ts-ignore
const { $docus } = useContext()

const route = useRoute()
const hover = ref(false)
const itemIndex = ref(null)
const currentNav = computed(() => $docus.get({ depth: 1 }).links)

// computed
Expand All @@ -43,23 +49,14 @@ export default defineComponent({
? route.value.params.pathMatch.split('/')[0]
: null
})

// methods
function hoverLinks(index) {
itemIndex.value = index
hover.value = true
}

return {
headerLinks,
currentSlug,
hoverLinks,
hover,
itemIndex
currentSlug
}
}
})
</script>

<style scoped lang="postcss">
.nuxt-link-active {
color: rgba(52, 211, 153);
Expand Down