Add navbar component
This commit is contained in:
parent
dbea420db5
commit
08edea3c50
2 changed files with 59 additions and 1 deletions
|
|
@ -1,14 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="app" class="text-black">
|
<div id="app" class="text-black">
|
||||||
{{ title }}
|
<navbar :name="title" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import Navbar from '@/components/navbar'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
|
|
||||||
|
components: {
|
||||||
|
Navbar
|
||||||
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
title: 'Bristol JS'
|
title: 'Bristol JS'
|
||||||
|
|
|
||||||
53
src/components/navbar.vue
Normal file
53
src/components/navbar.vue
Normal 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>
|
||||||
Reference in a new issue