// Slim page hero used at the top of every subpage.
// Dark teal anchor band, eyebrow + h1 + subhead, optional CTA row.
function PageHero({ eyebrow, title, italic, subhead, detail, ctas, primaryGold }) {
return (
{eyebrow && (
{eyebrow}
)}
{title}
{italic && <> {italic}>}
{subhead && (
{subhead}
)}
{detail && (
{detail}
)}
{ctas && ctas.length > 0 && (
)}
);
}
// Calendly inline embed used inside CTABand when calendar=true.
function CTABandCalendly({ url }) {
const ref = React.useRef(null);
const [height, setHeight] = React.useState(660);
React.useEffect(() => {
if (!url || !ref.current) return;
const existing = document.querySelector('script[data-calendly]');
if (!existing) {
const s = document.createElement('script');
s.src = 'https://assets.calendly.com/assets/external/widget.js';
s.async = true;
s.setAttribute('data-calendly', 'true');
document.body.appendChild(s);
} else if (window.Calendly && window.Calendly.initInlineWidget) {
window.Calendly.initInlineWidget({ url, parentElement: ref.current });
}
}, [url]);
React.useEffect(() => {
if (document.querySelector('link[data-calendly-css]')) return;
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'https://assets.calendly.com/assets/external/widget.css';
link.setAttribute('data-calendly-css', 'true');
document.head.appendChild(link);
}, []);
// Snap container to the height Calendly's iframe actually needs.
React.useEffect(() => {
function onMessage(e) {
if (!e.data || typeof e.data !== 'object') return;
if (e.data.event === 'calendly.page_height') {
const raw = e.data.payload && e.data.payload.height;
const h = typeof raw === 'number' ? raw : parseInt(raw, 10);
if (h > 100) setHeight(h);
}
}
window.addEventListener('message', onMessage);
return () => window.removeEventListener('message', onMessage);
}, []);
return (
);
}
function CTABand({ eyebrow, title, italic, body, primaryHref = 'contact.html', primaryLabel = 'Book A Free Call', secondaryHref, secondaryLabel, calendar = false, calendlyUrl = 'https://calendly.com/chekbooks-schedule/30min' }) {
return (
{eyebrow &&
{eyebrow}
}
{title}{italic && <> {italic}>}
{body &&
{body}
}
);
}
// Generic section heading block used inside content sections.
function SectionHeading({ eyebrow, title, subhead, align = 'center' }) {
return (
{eyebrow &&
{eyebrow}
}
{title}
{subhead &&
{subhead}
}
);
}
Object.assign(window, { PageHero, CTABand, SectionHeading });