"use client";

import { Button } from "@/components/ui/button";
import { Download } from "lucide-react";

export function DownloadButton({
  releaseId,
  version,
  size = "default",
}: {
  releaseId: string;
  version: string;
  size?: "default" | "sm" | "lg";
}) {
  function handleDownload() {
    window.open(`/api/download/${releaseId}`, "_blank");
  }

  return (
    <Button size={size} onClick={handleDownload}>
      <Download className="mr-2 h-4 w-4" />
      下载 v{version}
    </Button>
  );
}
