diff --git a/src/components/PDF.tsx b/src/components/PDF.tsx index 85467b2..caba512 100644 --- a/src/components/PDF.tsx +++ b/src/components/PDF.tsx @@ -1,18 +1,21 @@ import React, { useEffect, useRef } from "react"; import "./PDF.css"; - -// Import the PDF file import CV_PDF from "./_PDF/Lars_Flem_CV_english.pdf"; -// Define the PdfViewer component const PdfViewer: React.FC = () => { const pdfRef = useRef(null); useEffect(() => { if (pdfRef.current) { - // Calculate the height dynamically based on the window height const windowHeight = window.innerHeight; - pdfRef.current.style.height = `${windowHeight - 150}px`; // Subtract header/footer or any margin as needed + + if (window.innerWidth > 768) { + // Set height dynamically for larger screens + pdfRef.current.style.height = `${windowHeight - 150}px`; // Adjust as needed + } else { + // On mobile, allow scrolling and set auto height + pdfRef.current.style.height = "auto"; + } } }, []);