<script setup lang="ts">
import { Link } from '@inertiajs/vue3';
import { ArrowLeft } from '@lucide/vue';
import { Button } from '@/components/ui/button';

withDefaults(
    defineProps<{
        href?: string;
        label?: string;
    }>(),
    {
        label: 'Kembali',
    }
);
</script>

<template>
    <Button variant="outline" :as-child="!!href" class="shrink-0 self-start sm:self-center">
        <Link v-if="href" :href="href">
            <ArrowLeft class="size-4" />
            <slot>{{ label }}</slot>
        </Link>
        <template v-else>
            <ArrowLeft class="size-4" />
            <slot>{{ label }}</slot>
        </template>
    </Button>
</template>
