import { MailFilled, PrinterFilled } from "@ant-design/icons"; import { Space, Spin } from "antd"; import React, { useState } from "react"; import { GenerateDocument } from "../../utils/RenderTemplate"; export default function PrintWrapperComponent({ templateObject, messageObject = {}, children, id, emailOnly = false, }) { const [loading, setLoading] = useState(false); const handlePrint = async (type) => { setLoading(true); await GenerateDocument(templateObject, messageObject, type, id); setLoading(false); }; return ( {children || null} {!emailOnly && handlePrint("p")} />} handlePrint("e")} /> {loading && } ); }