"use client"
import { type JSX } from "react"
import { Button } from "@/components/ui/button"
import { Trash2 } from "lucide-react"
import { type ApiKeyWithOrg } from "./api-key-table"

export function DeleteApiKeyButton({
  deleteDialog,
  rowToDelete,
  setRowTodelete,
}: {
  deleteDialog: (open: boolean) => void
  rowToDelete: ApiKeyWithOrg | null
  setRowTodelete: (key: ApiKeyWithOrg | null) => void
}): JSX.Element {
  return (
    <Button
      className="icon"
      variant="ghost"
      type="submit"
      onClick={() => {
        setRowTodelete(rowToDelete)
        deleteDialog(true)
      }}
    >
      <Trash2 size={12} />
    </Button>
  )
}
