'use client'

import { Trash2 } from 'lucide-react'
import { deleteCategory } from './actions'

export default function DeleteButton({ id }: { id: number }) {
  return (
    <button 
      onClick={async () => {
        if (confirm('Bu kategoriyi silmek istediğinize emin misiniz?')) {
          const res = await deleteCategory(id)
          if (res?.error) {
            alert(res.error)
          }
        }
      }}
      className="p-2 text-red-600 hover:bg-red-50 rounded-lg transition-colors" 
      title="Sil"
    >
      <Trash2 size={18} />
    </button>
  )
}
