@opengis/fastify-table
Version:
core-plugins
13 lines (12 loc) • 551 B
JavaScript
import buttonPreview from "../utils/buttonPreview.js";
import buttonDownload from "../utils/buttonDownload.js";
export default function buttonFilePreviewHelper(data, options = {}) {
const { hash } = options;
if (data && typeof data !== "string")
return "wrong input data type";
if (!data)
return "";
const preview = buttonPreview(data);
const download = buttonDownload(data);
return `<div class='flex gap-x-2'>${hash?.action === "download" ? "" : preview}${hash?.action === "preview" ? "" : download}</div>`;
}