import {
  Heading
} from "./chunk-HK224ADT.js";
import {
  Flex
} from "./chunk-25HMMI7R.js";
import {
  Button
} from "./chunk-U7JPP7WJ.js";
import {
  Card
} from "./chunk-2ZQK7NTN.js";
import {
  DownloadIcon
} from "./chunk-OXXF2CUB.js";

// src/app/platform/report-card.tsx
import { useCallback } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
function ReportCard(props) {
  const { title, files, status } = props;
  const onClickDownload = useCallback((file) => {
    const { url, fileName } = file;
    const link = document.createElement("a");
    link.href = url;
    link.download = fileName;
    link.target = "_blank";
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
  }, []);
  return /* @__PURE__ */ jsxs(Card, { children: [
    /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "between", mb: "2", children: [
      /* @__PURE__ */ jsx(Heading, { variant: "heading4", children: title }),
      status
    ] }),
    /* @__PURE__ */ jsx(Flex, { children: files == null ? void 0 : files.map((file) => {
      return /* @__PURE__ */ jsxs(
        Button,
        {
          mb: "1",
          onClick: () => {
            onClickDownload(file);
          },
          variant: "surface",
          style: { width: "100%" },
          children: [
            /* @__PURE__ */ jsx(DownloadIcon, {}),
            file.buttonName
          ]
        },
        file.url
      );
    }) })
  ] });
}

export {
  ReportCard
};
//# sourceMappingURL=chunk-I2DCZRJH.js.map