import React, { useState } from 'react'; import { X } from 'lucide-react'; // Configuration of PDFs by country with direct links const COUNTRY_PDFS = { 'United States': 'https://example.com/path/to/us-book.pdf', 'United Kingdom': 'https://example.com/path/to/uk-book.pdf', 'France': 'https://example.com/path/to/fr-book.pdf', 'Germany': 'https://example.com/path/to/de-book.pdf', 'Spain': 'https://example.com/path/to/es-book.pdf', 'Italy': 'https://example.com/path/to/it-book.pdf', 'Japan': 'https://example.com/path/to/jp-book.pdf', 'China': 'https://example.com/path/to/cn-book.pdf', 'Brazil': 'https://example.com/path/to/br-book.pdf', // Add more countries as needed }; const MultilangBookWebsite = () => { const [selectedCountry, setSelectedCountry] = useState(''); const [downloadPopup, setDownloadPopup] = useState(false); const handleCountryChange = (e) => { setSelectedCountry(e.target.value); }; const openDownloadPopup = () => { setDownloadPopup(true); }; const closeDownloadPopup = (e) => { // Close popup if clicked outside if (e.target === e.currentTarget) { setDownloadPopup(false); } }; return (
Multilingual Book Collection
Select Your Country
{Object.keys(COUNTRY_PDFS).map(country => (
{country}
))}
{selectedCountry && (
Download PDF for {selectedCountry}
)} {downloadPopup && (
e.stopPropagation()} >
setDownloadPopup(false)} className="absolute top-4 right-4 text-slate-600 hover:text-slate-900" >
Download Confirmation
You are about to download the book in {selectedCountry}'s language.
Confirm Download
)}
); }; export default MultilangBookWebsite;