FIX: breaking tech list
Or rather non-breaking tech list
This commit is contained in:
parent
2d65119e7e
commit
4726749456
4 changed files with 17 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<component :is="actualComponent" v-bind="actualProps()" class="Button" :class="[design]">
|
||||
<component :is="actualComponent" v-bind="actualProps" class="Button" :class="[design]">
|
||||
<slot />
|
||||
</component>
|
||||
</template>
|
||||
|
@ -7,31 +7,29 @@
|
|||
<script setup lang="ts">
|
||||
|
||||
type Props = {
|
||||
type ?: 'NuxtLink' | 'button'
|
||||
href ?: string
|
||||
design ?: 'default' | 'dark' | 'white'
|
||||
}
|
||||
|
||||
const {
|
||||
type = 'NuxtLink',
|
||||
href = '#',
|
||||
href,
|
||||
design = 'default',
|
||||
} = defineProps<Props>()
|
||||
|
||||
const isExternal = href.startsWith('http')
|
||||
const isExternal = computed(() => href?.startsWith('http'))
|
||||
|
||||
const actualComponent = computed(() => {
|
||||
if (type === 'NuxtLink') return resolveComponent('NuxtLink')
|
||||
return type
|
||||
if (href) return resolveComponent('NuxtLink')
|
||||
return 'button'
|
||||
})
|
||||
|
||||
const actualProps = () => {
|
||||
if (type === 'NuxtLink') {
|
||||
return {
|
||||
to: href,
|
||||
target: isExternal ? '_blank' : undefined,
|
||||
external: isExternal,
|
||||
}
|
||||
const actualProps = computed(() => {
|
||||
if (!href) return
|
||||
|
||||
return {
|
||||
to: href,
|
||||
target: isExternal.value ? '_blank' : undefined,
|
||||
external: isExternal.value,
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue