<script setup lang="ts">
import { Link } from '@inertiajs/vue3';
import { Pencil } from '@lucide/vue';
import { Button } from '@/components/ui/button';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';

defineProps<{
    href?: string;
}>();
</script>

<template>
    <Tooltip>
        <TooltipTrigger as-child>
            <Button variant="ghost" size="icon" class="size-8" :as-child="!!href">
                <Link v-if="href" :href="href">
                    <Pencil class="size-4" />
                    <span class="sr-only">Ubah</span>
                </Link>
                <template v-else>
                    <Pencil class="size-4" />
                    <span class="sr-only">Ubah</span>
                </template>
            </Button>
        </TooltipTrigger>
        <TooltipContent>Ubah</TooltipContent>
    </Tooltip>
</template>
