Files
wp-headless/wp-content/themes/moonshine/app/components/acf/AcfLinkButton.vue
Pascal Martineau b89f02955d
All checks were successful
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Successful in 58s
feat: Replace eslint => oxlint + oxfmt
2026-02-01 22:00:54 -05:00

25 lines
669 B
Vue

<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;
showLabel?: boolean;
};
const { link, showLabel, ...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>{{ showLabel ? link.title : "" }}</slot>
</UButton>
</template>