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

defineProps<{
    tooltip?: string;
    disabled?: boolean;
    size?: 'default' | 'sm';
}>();

defineEmits<{
    click: [];
}>();
</script>

<template>
    <Tooltip>
        <TooltipTrigger as-child>
            <Button variant="ghost" :size="size === 'sm' ? 'sm' : 'icon'"
                :class="size === 'sm' ? '' : 'size-8'" class="text-destructive hover:text-destructive" :disabled="disabled"
                @click="$emit('click')">
                <X :class="size === 'sm' ? 'size-3.5' : 'size-4'" />
                <span class="sr-only">{{ tooltip || 'Tolak' }}</span>
            </Button>
        </TooltipTrigger>
        <TooltipContent>{{ tooltip || 'Tolak' }}</TooltipContent>
    </Tooltip>
</template>
