Add navbar component

This commit is contained in:
Oliver Davies 2020-09-08 20:02:56 +01:00
parent dbea420db5
commit 08edea3c50
2 changed files with 59 additions and 1 deletions

View file

@ -1,14 +1,19 @@
<template>
<div id="app" class="text-black">
{{ title }}
<navbar :name="title" />
</div>
</template>
<script>
import Navbar from '@/components/navbar'
export default {
name: 'App',
components: {
Navbar
},
data() {
return {
title: 'Bristol JS'

53
src/components/navbar.vue Normal file
View file

@ -0,0 +1,53 @@
<template>
<div class="bg-black">
<div class="max-w-6xl mx-auto py-6 px-4">
<div class="flex justify-between">
<div>
<a class="text-white font-bold" href="#" v-text="name"></a>
</div>
<nav class="space-x-6">
<a
class="
text-xs font-bold uppercase
hover:text-yellow
focus:text-yellow
"
href="#"
v-for="(link, i) in links"
:class="{
'text-yellow': link.isActive,
'text-white': !link.isActive
}"
:key="i"
>
{{ link.text }}
</a>
</nav>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Navbar',
props: {
name: {
type: String,
required: true
}
},
data() {
return {
links: [
{ text: 'Home', isActive: true },
{ text: 'Talks', isActive: false },
{ text: 'Contact', isActive: false }
]
}
}
}
</script>