<template>
  <NuxtLink :to="to || href" :target="(blank && '_blank') || target">
    <UButton :variant="variant" :size="size">
      <Icon v-if="leftIcon" :name="leftIcon" class="mr-1" />
      <ContentSlot unwrap="p" />
      <Icon v-if="rightIcon" :name="rightIcon" class="ml-1" />
    </UButton>
  </NuxtLink>
</template>

<script setup lang="ts">
defineProps<{
  variant?: 'solid' | 'outline' | 'ghost' | 'link' | 'soft';
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
  leftIcon?: string;
  rightIcon?: string;
  to?: string;
  href?: string;
  target?: string;
  blank?: boolean;
}>();
</script>
