Extract header buttons into a component
This commit is contained in:
parent
61e1cdfcf0
commit
56e658ec2f
42
src/components/HeaderButtons.vue
Normal file
42
src/components/HeaderButtons.vue
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<template>
|
||||||
|
<div class="hidden md:block">
|
||||||
|
<ul class="list-reset flex">
|
||||||
|
<li v-for="(link, i) in links" :key="link.title" :class="{'ml-6': i !== 0}">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="text-xs no-underline hover:underline flex flex-col items-center justify-center"
|
||||||
|
:class="{
|
||||||
|
'text-grey cursor-not-allowed': link.disabled,
|
||||||
|
'text-blue-dark': !link.disabled,
|
||||||
|
}"
|
||||||
|
:disabled="link.disabled"
|
||||||
|
>
|
||||||
|
<svg class="h-6 w-6 fill-current mb-2" role="presentation"><use :xlink:href="`/img/icons.symbol.svg#${link.icon}`"></use></svg>
|
||||||
|
{{ link.title }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<!-- <li class="ml-6">
|
||||||
|
<button type="button" class="text-xs text-blue-dark no-underline hover:underline flex flex-col items-center justify-center">
|
||||||
|
<svg class="h-6 w-6 text-blue-dark fill-current mb-2" role="presentation"><use xlink:href="/img/icons.symbol.svg#actions__info"></use></svg>
|
||||||
|
Git Info
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="ml-6">
|
||||||
|
<button type="button" class="text-xs text-grey-dark no-underline flex flex-col items-center justify-center cursor-not-allowed" disabled>
|
||||||
|
<svg class="h-6 w-6 fill-current text-grey-dark mb-2" role="presentation"><use xlink:href="/img/icons.symbol.svg#actions__edit"></use></svg>
|
||||||
|
Rename
|
||||||
|
</button>
|
||||||
|
</li> -->
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
links: Array,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -4,9 +4,11 @@ import router from './router'
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
|
import HeaderButtons from '@/components/HeaderButtons'
|
||||||
import Sidebar from '@/components/Sidebar'
|
import Sidebar from '@/components/Sidebar'
|
||||||
import Navbar from '@/components/Navbar'
|
import Navbar from '@/components/Navbar'
|
||||||
|
|
||||||
|
Vue.component('header-buttons', HeaderButtons);
|
||||||
Vue.component('navbar', Navbar);
|
Vue.component('navbar', Navbar);
|
||||||
Vue.component('sidebar', Sidebar);
|
Vue.component('sidebar', Sidebar);
|
||||||
|
|
||||||
|
|
|
@ -7,16 +7,9 @@
|
||||||
<div class="text-2xl font-hairline mr-2">Applications</div>
|
<div class="text-2xl font-hairline mr-2">Applications</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="hidden md:block">
|
<header-buttons :links="[
|
||||||
<ul class="list-reset flex">
|
{ title: 'Add Application', icon: 'alpha__new-app', disabled: false },
|
||||||
<li>
|
]"></header-buttons>
|
||||||
<button type="button" class="text-xs text-blue-dark no-underline hover:underline flex flex-col items-center justify-center">
|
|
||||||
<svg class="h-6 w-6 text-blue-dark fill-current mb-2" role="presentation"><use xlink:href="/img/icons.symbol.svg#alpha__new-app"></use></svg>
|
|
||||||
Add Application
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row-reverse flex-1 h-full">
|
<div class="flex flex-row-reverse flex-1 h-full">
|
||||||
|
|
|
@ -20,30 +20,11 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="hidden md:block">
|
<header-buttons :links="[
|
||||||
<ul class="list-reset flex">
|
{ title: 'Add database', icon: 'actions__new-database', disabled: false },
|
||||||
<li>
|
{ title: 'Git Info', icon: 'actions__info', disabled: false },
|
||||||
<button type="button" class="text-xs text-blue-dark no-underline hover:underline flex flex-col items-center justify-center">
|
{ title: 'Rename', icon: 'actions__edit', disabled: true },
|
||||||
<svg class="h-6 w-6 text-blue-dark fill-current mb-2" role="presentation"><use xlink:href="/img/icons.symbol.svg#actions__new-database"></use></svg>
|
]"></header-buttons>
|
||||||
Add database
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="ml-6">
|
|
||||||
<button type="button" class="text-xs text-blue-dark no-underline hover:underline flex flex-col items-center justify-center">
|
|
||||||
<svg class="h-6 w-6 text-blue-dark fill-current mb-2" role="presentation"><use xlink:href="/img/icons.symbol.svg#actions__info"></use></svg>
|
|
||||||
Git Info
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="ml-6">
|
|
||||||
<button type="button" class="text-xs text-grey-dark no-underline flex flex-col items-center justify-center cursor-not-allowed" disabled>
|
|
||||||
<svg class="h-6 w-6 fill-current text-grey-dark mb-2" role="presentation"><use xlink:href="/img/icons.symbol.svg#actions__edit"></use></svg>
|
|
||||||
Rename
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row-reverse h-full">
|
<div class="flex flex-row-reverse h-full">
|
||||||
|
|
Reference in a new issue