feat: Added Navbar component

This commit is contained in:
Ilya Artamonov
2022-11-17 21:05:24 +03:00
parent c658c323cd
commit 8f27fb03fd
12 changed files with 403 additions and 63 deletions

View File

@@ -0,0 +1,60 @@
import { defineComponent, h } from 'vue'
export default defineComponent({
name: 'NavbarLogo',
props: {
link: {
type: String,
default: '/',
},
imageUrl: {
type: String,
default: '/assets/logo.svg',
},
alt: {
type: String,
default: 'Logo',
},
component: {
type: [Object, String],
default: 'a',
},
linkAttr: {
type: String,
default: 'href',
},
},
emits: [
'click',
],
setup(props, { slots }) {
return () =>
h(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
props.component,
{
[props.linkAttr]: props.link,
class: 'flex items-center',
},
{
default: () => [
h(
'img',
{
src: props.imageUrl,
class: 'mr-3 h-6 sm:h-10',
alt: props.alt,
},
),
h(
'span',
{
class: 'self-center text-xl font-semibold whitespace-nowrap dark:text-white',
},
slots,
)],
},
)
},
})