function CollabHeading() {
const wrapRef = React.useRef(null);
const lineRef = React.useRef(null);
React.useEffect(() => {
const wrap = wrapRef.current, line = lineRef.current;
if (!wrap || !line) return;
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
// Was an unconditional infinite rAF loop -- a forced
// getBoundingClientRect() every frame for the page's entire
// lifetime, even while scrolling through sections nowhere near
// Contact (measured as the single largest idle contributor site-
// wide). Now gated by an IntersectionObserver so it only runs while
// this heading is anywhere near the viewport.
let rafId = null;
const update = () => {
const rect = wrap.getBoundingClientRect();
const vh = window.innerHeight;
const start = vh * 0.95, end = vh * 0.35;
let progress = (start - rect.top) / (start - end);
progress = Math.max(0, Math.min(1, progress));
const offset = (1 - progress) * 220;
line.style.transform = `translateX(${offset}px)`;
line.style.opacity = 0.25 + 0.75 * progress;
rafId = requestAnimationFrame(update);
};
const startLoop = () => { if (rafId === null) rafId = requestAnimationFrame(update); };
const stopLoop = () => { if (rafId !== null) { cancelAnimationFrame(rafId); rafId = null; } };
const io = new IntersectionObserver((entries) => {
if (entries[0].isIntersecting) startLoop(); else stopLoop();
}, { rootMargin: '50% 0px 50% 0px' });
io.observe(wrap);
return () => { stopLoop(); io.disconnect(); };
}, []);
return (
Let's Build Something
Amazing Together.
);
}
function Contact() {
const { Input, Button } = window.ArnelBiscarraDesignSystem_2766cb;
const [sent, setSent] = React.useState(false);
const [form, setForm] = React.useState({ name: '', email: '', phone: '', subject: '', message: '' });
const [copied, setCopied] = React.useState(false);
const copyTimerRef = React.useRef(null);
const copyEmail = (email) => (e) => {
e.preventDefault(); // the row's value is otherwise just a mailto link — this button copies instead of opening the mail app
const done = () => {
setCopied(true);
clearTimeout(copyTimerRef.current);
copyTimerRef.current = setTimeout(() => setCopied(false), 1800);
};
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(email).then(done).catch(() => fallbackCopy(email, done));
} else {
fallbackCopy(email, done);
}
};
// Fallback for browsers/contexts without the async Clipboard API
// (e.g. non-HTTPS): a temporary offscreen textarea + execCommand.
const fallbackCopy = (text, done) => {
const ta = document.createElement('textarea');
ta.value = text;
ta.style.position = 'fixed';
ta.style.left = '-9999px';
document.body.appendChild(ta);
ta.select();
try { document.execCommand('copy'); done(); } catch (err) {}
document.body.removeChild(ta);
};
const update = (k) => (e) => setForm((f) => ({ ...f, [k]: e.target.value }));
const submit = (e) => {
e.preventDefault();
const subject = form.subject ? `Portfolio inquiry: ${form.subject}` : 'Portfolio inquiry';
const body = `Name: ${form.name}\nEmail: ${form.email}\nPhone: ${form.phone}\n\n${form.message}`;
window.location.href = `mailto:arnelbiscarra@gmail.com?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
setSent(true);
};
return (
);
}
window.Contact = Contact;