Move sidbar into a component

This commit is contained in:
Oliver Davies 2018-12-25 22:46:21 +00:00
parent 762278b437
commit 61e1cdfcf0
4 changed files with 44 additions and 54 deletions

View file

@ -0,0 +1,31 @@
<template>
<div class="w-auto lg:w-64 bg-grey-darkest text-white antialiased">
<div>
<ul class="list-reset">
<li v-for="link in links" :key="link.title">
<a
href="#0"
class="flex items-center no-underline hover:underline focus:underline border-l-6 px-4 py-5"
:class="{
'border-blue bg-grey-darker': link.active,
'border-transparent': !link.active,
'text-grey cursor-not-allowed': link.disabled,
'text-white': !link.disabled,
}"
>
<svg class="h-6 w-6 fill-current" role="presentation"><use :xlink:href="`/img/icons.symbol.svg#${link.icon}`"></use></svg>
<span class="hidden lg:block lg:ml-4">{{ link.title }}</span>
</a>
</li>
</ul>
</div>
</div>
</template>
<script>
export default {
props: {
links: Array,
},
}
</script>

View file

@ -4,9 +4,11 @@ import router from './router'
Vue.config.productionTip = false
import Sidebar from '@/components/Sidebar'
import Navbar from '@/components/Navbar'
Vue.component('navbar', Navbar);
Vue.component('sidebar', Sidebar);
new Vue({
render: h => h(App),

View file

@ -52,30 +52,11 @@
</div>
</div>
<div class="w-auto lg:w-64 bg-grey-darkest text-white antialiased">
<div>
<ul class="list-reset">
<li>
<a href="#0" class="flex items-center text-white no-underline hover:underline focus:underline border-l-6 border-blue px-4 py-5 bg-grey-darker">
<svg class="h-6 w-6 text-white fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#alpha__grid"></use></svg>
<span class="hidden lg:block lg:ml-4">All</span>
</a>
</li>
<li>
<a href="#0" class="flex items-center text-white no-underline hover:underline focus:underline border-l-6 border-transparent px-4 py-5">
<svg class="h-6 w-6 text-white fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#state__starred"></use></svg>
<span class="hidden lg:block lg:ml-4">Starred</span>
</a>
</li>
<li>
<a href="#0" class="flex items-center text-white no-underline hover:underline focus:underline border-l-6 border-transparent px-4 py-5">
<svg class="h-6 w-6 text-white fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#objects__recent"></use></svg>
<span class="hidden lg:block lg:ml-4">Recents</span>
</a>
</li>
</ul>
</div>
</div>
<sidebar :links="[
{ title: 'All', icon: 'alpha__grid', active: true, disabled: false },
{ title: 'Starred', icon: 'state__starred', active: false, disabled: false },
{ title: 'Recents', icon: 'objects__recent', active: false, disabled: false },
]"></sidebar>
</div>
</div>
</template>

View file

@ -75,36 +75,12 @@
<task-log></task-log>
</div>
<div class="w-auto lg:w-64 bg-grey-darkest text-white antialiased">
<div>
<ul class="list-reset">
<li>
<a href="#0" class="flex items-center text-white no-underline hover:underline focus:underline border-l-6 border-blue px-4 py-5 bg-grey-darker">
<svg class="h-6 w-6 text-white fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#alpha__grid"></use></svg>
<span class="hidden lg:block lg:ml-4">Environments</span>
</a>
</li>
<li>
<div class="flex items-center text-grey no-underline hover:underline focus:underline border-l-6 border-transparent px-4 py-5 cursor-not-allowed hover:bg-grey-darker">
<svg class="h-6 w-6 text-grey fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#locations__keys"></use></svg>
<span class="hidden lg:block lg:ml-4">Product Keys</span>
</div>
</li>
<li>
<div class="flex items-center text-grey no-underline hover:underline focus:underline border-l-6 border-transparent px-4 py-5 cursor-not-allowed hover:bg-grey-darker">
<svg class="h-6 w-6 text-grey fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#alpha__security"></use></svg>
<span class="hidden lg:block lg:ml-4">Security</span>
</div>
</li>
<li>
<a href="#0" class="flex items-center text-white no-underline hover:underline focus:underline border-l-6 border-transparent px-4 py-5 hover:bg-grey-darker">
<svg class="h-6 w-6 text-white fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#actions__search"></use></svg>
<span class="hidden lg:block lg:ml-4">Acquia Search</span>
</a>
</li>
</ul>
</div>
</div>
<sidebar :links="[
{ title: 'Environments', icon: 'alpha__grid', active: true, disabled: false },
{ title: 'Product Keys', icon: 'locations__keys', active: false, disabled: true },
{ title: 'Security', icon: 'alpha__security', active: false, disabled: true },
{ title: 'Acquia Search', icon: 'actions__search', active: false, disabled: false },
]"></sidebar>
</div>
</div>
</template>