'use client' import { suitableApi } from '@/api/suitable' import { useQuery } from '@tanstack/react-query' import generatePDF, { usePDF, Options } from 'react-to-pdf' import PDFContent from './SuitablePdf' const pdfOptions: Options = { filename: 'page.pdf', method: 'save', page: { format: 'a4', margin: 10 }, overrides: { pdf: { compress: true, }, }, } export default function SuitableDetails({ roofMaterial }: { roofMaterial: string }) { const { data, isLoading } = useQuery({ queryKey: ['suitable-details'], queryFn: () => suitableApi.getDetails(roofMaterial), staleTime: 0, enabled: !!roofMaterial, }) const { toPDF, targetRef } = usePDF({ ...pdfOptions, method: 'open' }) if (isLoading) { return
Loading...
} return ( <> {/* */} {/*
*/}

Searched Roof Material: {decodeURIComponent(roofMaterial as string)}

{data && data.map((item) => (

product_name: {item.product_name}
manufacturer: {item.manufacturer}
roof_material: {item.roof_material}
shape: {item.shape}
support_roof_tile: {item.support_roof_tile}
support_roof_bracket: {item.support_roof_bracket}
yg_anchor: {item.yg_anchor}
))}
{/*
*/}

PDF 내용 나와라

) }