feat: AcfLink / AcfLinkButton components
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import type { AcfLinkFragment } from "#graphql/operations";
|
||||
import type { ButtonProps } from "@nuxt/ui";
|
||||
|
||||
type AcfLinkButtonProps = & Omit<ButtonProps, "to" | "target" | "href"> & {
|
||||
link?: AcfLinkFragment;
|
||||
};
|
||||
|
||||
const { link, ...buttonProps } = defineProps<AcfLinkButtonProps>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UButton
|
||||
v-if="link?.url && link?.title"
|
||||
v-bind="buttonProps"
|
||||
:to="link.url"
|
||||
:target="link.target"
|
||||
:external="link.target === '_blank'"
|
||||
:rel="link.target === '_blank' ? 'noopener noreferrer' : undefined"
|
||||
>
|
||||
<slot>{{ link.title }}</slot>
|
||||
</UButton>
|
||||
</template>
|
||||
Reference in New Issue
Block a user