feat: AcfLink / AcfLinkButton components

This commit is contained in:
2026-01-30 10:24:06 -05:00
parent 6b17201f60
commit 115a5d2d38
6 changed files with 152 additions and 1 deletions

View File

@@ -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>