/* global React */
function LegalModal({ type, onClose }) {
const t = window.useT();
const overlayRef = React.useRef(null);
const avisoSections = [
{ heading: t('footer.legal.aviso.section_0.heading'), body: t('footer.legal.aviso.section_0.body') },
{ heading: t('footer.legal.aviso.section_1.heading'), body: t('footer.legal.aviso.section_1.body') },
{ heading: t('footer.legal.aviso.section_2.heading'), body: t('footer.legal.aviso.section_2.body') },
{ heading: t('footer.legal.aviso.section_3.heading'), body: t('footer.legal.aviso.section_3.body') },
{ heading: t('footer.legal.aviso.section_4.heading'), body: t('footer.legal.aviso.section_4.body') },
];
const privacidadSections = [
{ heading: t('footer.legal.privacidad.section_0.heading'), body: t('footer.legal.privacidad.section_0.body') },
{ heading: t('footer.legal.privacidad.section_1.heading'), body: t('footer.legal.privacidad.section_1.body') },
{ heading: t('footer.legal.privacidad.section_2.heading'), body: t('footer.legal.privacidad.section_2.body') },
{ heading: t('footer.legal.privacidad.section_3.heading'), body: t('footer.legal.privacidad.section_3.body') },
{ heading: t('footer.legal.privacidad.section_4.heading'), body: t('footer.legal.privacidad.section_4.body') },
{ heading: t('footer.legal.privacidad.section_5.heading'), body: t('footer.legal.privacidad.section_5.body') },
{ heading: t('footer.legal.privacidad.section_6.heading'), body: t('footer.legal.privacidad.section_6.body') },
{ heading: t('footer.legal.privacidad.section_7.heading'), body: t('footer.legal.privacidad.section_7.body') },
];
const contentTitle = type === 'aviso' ? t('footer.legal.aviso.title') : t('footer.legal.privacidad.title');
const sections = type === 'aviso' ? avisoSections : privacidadSections;
React.useEffect(() => {
const prev = document.body.style.overflow;
document.body.style.overflow = 'hidden';
const onKey = (e) => { if (e.key === 'Escape') onClose(); };
window.addEventListener('keydown', onKey);
return () => {
document.body.style.overflow = prev;
window.removeEventListener('keydown', onKey);
};
}, []);
return (
{ if (e.target === overlayRef.current) onClose(); }}
style={{
position: 'fixed', inset: 0, zIndex: 200,
background: 'rgba(27,20,16,0.72)',
backdropFilter: 'blur(8px)',
WebkitBackdropFilter: 'blur(8px)',
display: 'flex', alignItems: 'center', justifyContent: 'center',
padding: '24px 16px',
animation: 'legalFadeIn 240ms ease',
}}>
{/* Header */}
{t('footer.legal.modal_header_prefix')}
{contentTitle}
{/* Content */}
{sections.map((s, i) => (
0 ? 28 : 0,
borderTop: i > 0 ? '1px solid rgba(60,40,20,0.1)' : 'none',
}}>
{s.heading}
{s.body.split('\n\n').map((para, j) => (
{para}
))}
))}
{t('footer.legal.last_update')}
);
}
function Footer() {
const t = window.useT();
const titleRef = React.useRef(null);
const subtitleRef = React.useRef(null);
const [legalModal, setLegalModal] = React.useState(null);
React.useEffect(() => {
const fit = () => {
const t = titleRef.current, s = subtitleRef.current;
if (!t || !s) return;
if (!window.matchMedia('(min-width: 769px)').matches) {
t.style.letterSpacing = '0';
return;
}
t.style.letterSpacing = '0';
const target = s.getBoundingClientRect().width;
const natural = t.getBoundingClientRect().width;
const chars = t.textContent.length - 1;
if (chars > 0 && target > natural) {
t.style.letterSpacing = ((target - natural) / chars) + 'px';
}
};
fit();
window.addEventListener('resize', fit);
if (document.fonts && document.fonts.ready) document.fonts.ready.then(fit);
return () => window.removeEventListener('resize', fit);
}, []);
const navigate = (id) => {
if (id === 'top') {
window.scrollTo({ top: 0, behavior: 'smooth' });
return;
}
const el = document.getElementById(id);
if (el) window.scrollTo({ top: el.offsetTop - 60, behavior: 'smooth' });
};
const cols = [
{
title: t('footer.col.redes.title'),
items: [
['Instagram', 'https://www.instagram.com/eidora.projects'],
['LinkedIn', 'https://www.linkedin.com/in/joaquin-prados-cordon/'],
['Facebook', 'https://www.facebook.com/profile.php?id=61589526479409'],
],
},
{
title: t('footer.col.sistema.title'),
items: [
[t('footer.col.sistema.contenido'), null],
[t('footer.col.sistema.branding'), null],
[t('footer.col.sistema.publicidad'), null],
],
},
{
title: t('footer.col.contacto.title'),
items: [
['info@eidoraprojects.com', 'mailto:info@eidoraprojects.com'],
['+34 614 32 55 64', 'tel:+34614325564'],
['+34 687 05 25 35', 'tel:+34687052535'],
],
},
];
return (
);
}
window.Footer = Footer;