2018-11-19 20:41:47 +00:00
< template >
2018-11-20 13:14:40 +00:00
< div >
2018-11-19 20:41:47 +00:00
< button
type = "button"
2019-03-21 00:27:18 +00:00
class = "w-full p-3 block sm:hidden bg-blue-100 text-sm text-grey-600 text-left focus:outline-none"
2018-11-19 20:41:47 +00:00
@ click = "open = !open"
>
< div class = "flex items-center justify-between" >
< div >
{ { navText } } - Main navigation
< / div >
< div >
2019-06-11 23:13:46 +01:00
< img src = "@/assets/img/hamburger.svg" alt = "" >
2018-11-19 20:41:47 +00:00
< / div >
< / div >
< / button >
2019-03-10 00:15:27 +00:00
< div class = "xl:max-w-6xl mx-auto px-4 sm:block" : class = "[ open ? 'block' : 'hidden' ]" >
2018-11-20 02:26:07 +00:00
< div class = "mt-2 sm:mt-0" >
< nav class = "flex flex-wrap pb-1 md:p-0 -mx-3 sm:-mx-0" >
< div
class = "px-1 sm:pl-0 mb-1 md:mb-0 inline-block w-full sm:w-1/3 md:w-auto"
: key = "link.title"
2018-11-20 20:16:42 +00:00
v - for = "(link, index) in links"
2018-11-20 02:26:07 +00:00
>
< a
class = "block text-sm no-underline text-black px-3 py-2 rounded-lg md:rounded-none md:rounded-t-lg sm:text-center"
2019-03-21 00:27:18 +00:00
: class = "[ index == activeTab ? 'bg-white' : 'bg-blue-100 hover:bg-white' ]"
2018-11-20 02:26:07 +00:00
: href = "link.href"
>
{ { link . title } }
< / a >
< / div >
< / nav >
< / div >
2018-11-19 20:41:47 +00:00
< / div >
< / div >
< / template >
< script >
2019-03-30 00:13:30 +00:00
export default {
data : function ( ) {
return {
activeTab : 0 ,
open : false ,
links : [
{
title : 'Home' ,
href : '#0'
} ,
{
title : 'Drupal' ,
href : 'https://www.drupal.org'
} ,
{
title : 'Vue.js' ,
href : 'https://vuejs.org'
} ,
{
title : 'Tailwind CSS' ,
href : 'https://tailwindcss.com'
} ,
{
title : 'View code on GitHub' ,
href : 'https://github.com/opdavies/rebuilding-bartik'
} ,
{
title : 'Read blog post' ,
href : 'https://www.oliverdavies.uk/blog/rebuilding-bartik-with-vuejs-tailwind-css'
}
]
}
} ,
2018-11-19 20:41:47 +00:00
2019-03-30 00:13:30 +00:00
computed : {
navText : function ( ) {
return this . open ? 'Hide' : 'Show'
2018-11-19 20:41:47 +00:00
}
}
2019-03-30 00:13:30 +00:00
}
2018-11-19 20:41:47 +00:00
< / script >