Resources Mega Menu 1
Resources mega menu: turns the navigation into a lead-capture board. Free covers sit one tap from 'Get it free',
Use it in a prompt
Use nav/resources-mega-menu from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/nav/resources-mega-menu.tsx. - Import it and pass your copy and images (Props tab):
import { ResourcesMegaMenu } from "@/components/funneldna/nav/resources-mega-menu"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/nav/resources-mega-menu/component.tsx 670 lines
// layout: fact-scoreboard
// Resources mega menu: turns the navigation into a lead-capture board. Free covers sit one tap from 'Get it free',
// a dated workshop tile carries the one primary action, and a start-here path walks new visitors to the offer.
import * as React from 'react';
import { ChevronDown, Lock, Menu, X } from 'lucide-react';
export type MegaMenuResource = {
title: string;
/** Format word shown under the title, e.g. 'Free checklist'. */
kind?: string;
/** Short format detail, e.g. 'PDF' or 'Printable'. */
meta?: string;
benefit?: React.ReactNode;
/** Cover image (slot item-n). */
image?: string;
imageAlt?: string;
href?: string;
/** Text on the cover card's action; defaults to copy.getItFree. */
actionLabel?: string;
};
export type MegaMenuEvent = {
/** Chip beside the date, e.g. 'Free workshop'. */
kind?: string;
title?: string;
lead?: string;
/** Scoreboard date: month word, day number and a time line. */
date?: { month: string; day: string; line?: string };
/** Shown instead of a date line when the event has no date, e.g. 'On demand'. */
whenLabel?: string;
};
export type MegaMenuStep = {
title: string;
detail?: string;
href?: string;
/** Price on this step, e.g. '$47 once'. */
price?: string;
/** Supplied breakdown under the price, e.g. 'about $1.57 a day for a month'. */
priceNote?: string;
};
export type MegaMenuLink = { label: string; href: string };
/** Every word the menu shows or reads out; the approved copy is the default (DEFAULT_COPY below). */
export type ResourcesMegaMenuCopy = {
/** Accessible name of the navigation landmark. */
navLabel: string;
triggerLabel: string;
/** Count chip on the trigger; {count} is the number of free resources shown. */
countLabel: string;
panelHeading: string;
/** Aside in the author's voice under the heading; empty hides it. */
aside: string;
/** Default text on each cover card's action. */
getItFree: string;
startHeading: string;
/** Screen-reader prefix on each step; {n} is the step number. */
stepLabel: string;
/** Privacy line under the main action; empty hides it. */
privacy: string;
/** Accessible label on the phone menu button while closed. */
openMenu: string;
/** Accessible label on the phone menu button while open. */
closeMenu: string;
/** Accessible name of the page list at the foot of the phone menu. */
moreLinksLabel: string;
};
export type ResourcesMegaMenuProps = {
brandName?: string;
brandHref?: string;
/** Logo image (slot logo). */
logoImage?: string;
logoAlt?: string;
/** Other top-level pages in the bar (and at the foot of the phone menu). */
links?: MegaMenuLink[];
/** Three or four free lead magnets; the first four are shown. */
resources?: MegaMenuResource[];
event?: MegaMenuEvent;
steps?: MegaMenuStep[];
/** Main action text on the workshop tile (and the bar, unless barActionLabel is set). */
actionLabel?: string;
/** Small line under the main action text. */
actionSublabel?: string;
/** Bar button text; defaults to actionLabel. */
barActionLabel?: string;
/** Bar button text on phones. */
barActionShortLabel?: string;
/** Destination of both primary actions. */
href?: string;
onAction?: (event: React.MouseEvent<HTMLElement>) => void;
/** Called when a cover card is clicked, with the resource and its index. */
onResourceAction?: (resource: MegaMenuResource, index: number, event: React.MouseEvent<HTMLElement>) => void;
actionDisabled?: boolean;
/** Keep the bar pinned to the top of the viewport. */
sticky?: boolean;
/** true: the panel drops over the page; false: it opens in the flow and pushes content down. */
overlay?: boolean;
defaultOpen?: boolean;
onOpenChange?: (open: boolean) => void;
copy?: Partial<ResourcesMegaMenuCopy>;
className?: string;
};
export function ResourcesMegaMenu(props: ResourcesMegaMenuProps) {
const {
brandName = '',
brandHref = '#',
logoImage,
logoAlt = '',
links = [],
resources = [],
event,
steps = [],
actionLabel = 'Yes! Save My Seat',
actionSublabel = 'Free workshop · Watch online',
barActionLabel,
barActionShortLabel = 'Save My Seat',
href,
onAction,
onResourceAction,
actionDisabled = false,
sticky = false,
overlay = true,
defaultOpen = false,
onOpenChange,
className,
} = props;
const copy: ResourcesMegaMenuCopy = { ...DEFAULT_COPY, ...props.copy };
const uid = React.useId();
const panelId = uid + '-panel';
const headingId = uid + '-heading';
const [open, setOpenState] = React.useState(defaultOpen);
const rootRef = React.useRef<HTMLDivElement>(null);
const panelRef = React.useRef<HTMLDivElement>(null);
const deskTriggerRef = React.useRef<HTMLButtonElement>(null);
const menuTriggerRef = React.useRef<HTMLButtonElement>(null);
const lastTriggerRef = React.useRef<HTMLButtonElement | null>(null);
const focusFirstRef = React.useRef(false);
const onOpenChangeRef = React.useRef(onOpenChange);
React.useEffect(() => {
onOpenChangeRef.current = onOpenChange;
}, [onOpenChange]);
const setOpen = React.useCallback((next: boolean) => {
setOpenState(next);
onOpenChangeRef.current?.(next);
}, []);
const focusFirst = () => {
panelRef.current?.querySelector<HTMLElement>('a[href], button:not([disabled])')?.focus();
};
// Overlay mode closes on a pointer press outside the menu.
React.useEffect(() => {
if (!open || !overlay) return;
const onPointerDown = (e: PointerEvent) => {
const root = rootRef.current;
if (root && e.target instanceof Node && !root.contains(e.target)) setOpen(false);
};
document.addEventListener('pointerdown', onPointerDown);
return () => document.removeEventListener('pointerdown', onPointerDown);
}, [open, overlay, setOpen]);
// ArrowDown on a closed trigger opens the panel, then moves focus into it once rendered.
React.useEffect(() => {
if (!open || !focusFirstRef.current) return;
focusFirstRef.current = false;
focusFirst();
}, [open]);
const visibleTrigger = () => {
const list = [lastTriggerRef.current, deskTriggerRef.current, menuTriggerRef.current];
return list.find((el) => el !== null && el.offsetParent !== null) ?? null;
};
const toggle = (trigger: HTMLButtonElement) => {
lastTriggerRef.current = trigger;
setOpen(!open);
};
const onTriggerKeyDown = (e: React.KeyboardEvent<HTMLButtonElement>) => {
if (e.key !== 'ArrowDown') return;
e.preventDefault();
lastTriggerRef.current = e.currentTarget;
if (open) {
focusFirst();
} else {
focusFirstRef.current = true;
setOpen(true);
}
};
const onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
if (e.key !== 'Escape' || !open) return;
e.stopPropagation();
const trigger = visibleTrigger();
setOpen(false);
trigger?.focus();
};
const onBlur = (e: React.FocusEvent<HTMLDivElement>) => {
if (!overlay || !open) return;
const next = e.relatedTarget;
if (next instanceof Node && rootRef.current && !rootRef.current.contains(next)) setOpen(false);
};
const shown = resources.slice(0, 4);
const when = event?.date?.line ?? event?.whenLabel;
const [privacyFirst, privacyRest] = splitFirstWord(copy.privacy);
const rootClass = ['cf-resources-mega-menu', sticky ? 'is-sticky' : '', overlay ? '' : 'is-inline', open ? 'is-open' : '', className ?? '']
.filter(Boolean)
.join(' ');
return (
<div ref={rootRef} className={rootClass} onKeyDown={onKeyDown} onBlur={onBlur}>
<style>{CSS}</style>
<div className='rmm-bar'>
<nav className='rmm-bar-in' aria-label={copy.navLabel}>
{brandName || logoImage ? (
<a className='rmm-brand' href={brandHref}>
{logoImage ? <img src={logoImage} alt={brandName ? '' : logoAlt} width={160} height={32} /> : null}
{brandName ? <span className='rmm-brand-text'>{brandName}</span> : null}
</a>
) : null}
<ul className='rmm-links' role='list'>
<li>
<button
ref={deskTriggerRef}
type='button'
className='rmm-trigger'
aria-expanded={open}
aria-controls={panelId}
onClick={(e) => toggle(e.currentTarget)}
onKeyDown={onTriggerKeyDown}
>
<span>{copy.triggerLabel}</span>
{shown.length > 0 ? <span className='rmm-count'>{fill(copy.countLabel, { count: shown.length })}</span> : null}
<ChevronDown size={18} strokeWidth={2.5} aria-hidden='true' />
</button>
</li>
{links.map((link) => (
<li key={link.href + link.label}>
<a className='rmm-link' href={link.href}>{link.label}</a>
</li>
))}
</ul>
<PrimaryAction className='rmm-cta rmm-cta--bar' href={href} onAction={onAction} disabled={actionDisabled}>
<span className='rmm-cta-long'>{barActionLabel ?? actionLabel}</span>
<span className='rmm-cta-short'>{barActionShortLabel}</span>
</PrimaryAction>
<button
ref={menuTriggerRef}
type='button'
className='rmm-menu'
aria-expanded={open}
aria-controls={panelId}
aria-label={open ? copy.closeMenu : copy.openMenu}
onClick={(e) => toggle(e.currentTarget)}
>
{open ? <X size={24} strokeWidth={2.5} aria-hidden='true' /> : <Menu size={24} strokeWidth={2.5} aria-hidden='true' />}
</button>
</nav>
</div>
<div className='rmm-drop' hidden={!open}>
<div ref={panelRef} id={panelId} className='rmm-panel' role='region' aria-labelledby={headingId}>
<div className='rmm-head'>
<h2 id={headingId} className='rmm-h2'>{copy.panelHeading}</h2>
{copy.aside ? <p className='rmm-aside'>{copy.aside}</p> : null}
</div>
{shown.length > 0 ? (
<ul className='rmm-res-grid' role='list' style={{ '--rmm-count': shown.length } as React.CSSProperties}>
{shown.map((r, i) => {
const kindLine = [r.kind, r.meta].filter(Boolean).join(' · ');
const inner = (
<>
{r.image ? (
<span className='rmm-cover'>
<img src={r.image} alt={r.imageAlt ?? ''} width={320} height={240} loading='lazy' decoding='async' />
</span>
) : null}
<span className='rmm-res-body'>
<span className='rmm-res-title'>{r.title}</span>
{kindLine ? <span className='rmm-res-meta'>{kindLine}</span> : null}
{r.benefit ? <span className='rmm-res-benefit'>{r.benefit}</span> : null}
</span>
<span className='rmm-get'>{r.actionLabel ?? copy.getItFree}</span>
</>
);
const cls = r.image ? 'rmm-res' : 'rmm-res no-cover';
const click = onResourceAction
? (e: React.MouseEvent<HTMLElement>) => onResourceAction(r, i, e)
: undefined;
return (
<li key={r.title + i}>
{r.href ? (
<a className={cls} href={r.href} onClick={click}>{inner}</a>
) : (
<button type='button' className={cls} onClick={click}>{inner}</button>
)}
</li>
);
})}
</ul>
) : null}
<div className='rmm-event'>
{event?.date || event?.kind || when ? (
<div className='rmm-when'>
{event?.date ? (
<span className='rmm-board'>
<span className='rmm-board-month'>{event.date.month}</span>
<span className='rmm-board-day'>{event.date.day}</span>
</span>
) : null}
<span className='rmm-when-text'>
{event?.kind ? <span className='rmm-chip-band'>{event.kind}</span> : null}
{when ? <span className='rmm-when-line'>{when}</span> : null}
</span>
</div>
) : null}
{event?.title ? <h3 className='rmm-event-title'>{event.title}</h3> : null}
{event?.lead ? <p className='rmm-event-lead'>{event.lead}</p> : null}
<div className='rmm-event-foot'>
<PrimaryAction className='rmm-cta rmm-cta--lg' href={href} onAction={onAction} disabled={actionDisabled}>
<span className='rmm-cta-label'>{actionLabel}</span>
{actionSublabel ? <span className='rmm-cta-sub'>{actionSublabel}</span> : null}
</PrimaryAction>
{copy.privacy ? (
<p className='rmm-privacy'>
<span className='rmm-nobr'>
<Lock size={16} strokeWidth={2.5} aria-hidden='true' />
{privacyFirst}
</span>
{privacyRest ? ' ' + privacyRest : null}
</p>
) : null}
</div>
</div>
{steps.length > 0 ? (
<div className='rmm-start'>
<h3 className='rmm-start-h'>{copy.startHeading}</h3>
<ol className='rmm-steps' role='list'>
{steps.map((st, i) => {
const body = (
<>
<span className='rmm-step-num' aria-hidden='true'>{i + 1}</span>
<span className='rmm-step-text'>
<span className='rmm-sr'>{fill(copy.stepLabel, { n: i + 1 })} </span>
<span className='rmm-step-title'>{st.title}</span>
{st.detail ? <span className='rmm-step-detail'>{st.detail}</span> : null}
{st.price ? (
<span className='rmm-price'>
<span className='rmm-price-big'>{st.price}</span>
{st.priceNote ? <span className='rmm-price-note'>{st.priceNote}</span> : null}
</span>
) : null}
</span>
</>
);
return (
<li key={st.title + i}>
{st.href ? <a className='rmm-step' href={st.href}>{body}</a> : <div className='rmm-step is-static'>{body}</div>}
</li>
);
})}
</ol>
</div>
) : null}
{links.length > 0 ? (
<ul className='rmm-mlinks' role='list' aria-label={copy.moreLinksLabel}>
{links.map((link) => (
<li key={link.href + link.label}>
<a href={link.href}>{link.label}</a>
</li>
))}
</ul>
) : null}
</div>
</div>
</div>
);
}
export default ResourcesMegaMenu;
const DEFAULT_COPY: ResourcesMegaMenuCopy = {
navLabel: 'Main',
triggerLabel: 'Free resources',
countLabel: '{count} free',
panelHeading: 'Grab a free head start',
aside: '',
getItFree: 'Get it free',
startHeading: 'New here? Start in this order',
stepLabel: 'Step {n}:',
privacy: 'We respect your inbox. Unsubscribe anytime.',
openMenu: 'Open menu',
closeMenu: 'Close menu',
moreLinksLabel: 'More pages',
};
// The primary button reads the button role tokens in CSS (.rmm-cta) and its face inline, so the role is
// visible to the lint even though the class arrives as a prop.
const BUTTON_FACE: React.CSSProperties = { fontFamily: 'var(--button-font, var(--font-display, inherit))' };
function PrimaryAction({
href,
onAction,
disabled,
className,
children,
}: {
href?: string;
onAction?: (event: React.MouseEvent<HTMLElement>) => void;
disabled?: boolean;
className: string;
children: React.ReactNode;
}) {
if (disabled) {
return (
<button type='button' className={className} style={BUTTON_FACE} disabled>
{children}
</button>
);
}
if (href) {
return (
<a className={className} style={BUTTON_FACE} href={href} onClick={onAction}>
{children}
</a>
);
}
return (
<button type='button' className={className} style={BUTTON_FACE} onClick={onAction}>
{children}
</button>
);
}
// Splits off the first word so the lock icon stays glued to it when the privacy line wraps.
function splitFirstWord(text: string): [string, string] {
const trimmed = text.trim();
const at = trimmed.search(/\s/);
if (at < 0) return [trimmed, ''];
return [trimmed.slice(0, at), trimmed.slice(at + 1).trim()];
}
// Replaces {name} placeholders in a copy template with plain text.
function fill(template: string, vars: Record<string, string | number>) {
return Object.keys(vars).reduce((out, key) => out.split('{' + key + '}').join(String(vars[key])), template);
}
// Theme: every colour is a token or an OKLCH recipe on a token; hex appears only as var() fallbacks.
// Display-face titles, numbers, months and prices take their weight from --display-weight.
const CSS = `
.cf-resources-mega-menu {
--rmm-gutter: clamp(16px, 5vw, 48px);
--rmm-ease: cubic-bezier(.2, .7, .2, 1);
--rmm-shade: var(--shadow, oklch(0.22 0.03 260));
--rmm-well: color-mix(in oklch, var(--ink, #101828) 4%, var(--card, #ffffff));
--rmm-well-hover: color-mix(in oklch, var(--ink, #101828) 7%, var(--card, #ffffff));
position: relative;
z-index: 30;
background: var(--surface, #ffffff);
color: var(--ink, #101828);
font-family: var(--font-body, system-ui, sans-serif);
}
.cf-resources-mega-menu, .cf-resources-mega-menu *, .cf-resources-mega-menu *::before, .cf-resources-mega-menu *::after { box-sizing: border-box; }
.cf-resources-mega-menu :where(h2, h3, p, ul, ol, li) { margin: 0; padding: 0; }
.cf-resources-mega-menu.is-sticky { position: sticky; top: 0; z-index: 50; }
.cf-resources-mega-menu .rmm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cf-resources-mega-menu :is(a, button):focus-visible { outline: 3px solid var(--field-focus, var(--accent, #2563eb)); outline-offset: 2px; }
.cf-resources-mega-menu .rmm-event :is(a, button):focus-visible { outline-color: var(--band-ink, #ffffff); outline-offset: 3px; }
.cf-resources-mega-menu .rmm-bar { position: relative; z-index: 2; background: var(--surface, #ffffff); box-shadow: var(--shadow-sm, 0 1px 1px oklch(0.22 0.03 260 / .18), 0 1px 3px oklch(0.22 0.03 260 / .14)); }
.cf-resources-mega-menu .rmm-bar-in { display: flex; align-items: center; gap: 24px; min-height: 72px; max-width: calc(1120px + 2 * var(--rmm-gutter)); margin-inline: auto; padding-inline: var(--rmm-gutter); }
.cf-resources-mega-menu .rmm-brand { display: inline-flex; flex: 0 1 auto; align-items: center; gap: 12px; min-width: 0; color: var(--ink, #101828); font-family: var(--font-display, inherit); font-size: 1.3125rem; font-weight: var(--display-weight, 800); letter-spacing: var(--display-tracking, -0.025em); line-height: 1.15; text-decoration: none; }
.cf-resources-mega-menu .rmm-brand img { display: block; width: auto; height: 32px; max-width: 160px; object-fit: contain; }
.cf-resources-mega-menu .rmm-brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-resources-mega-menu .rmm-links { display: flex; flex: 1 1 auto; align-items: center; gap: 4px; min-width: 0; list-style: none; }
.cf-resources-mega-menu .rmm-links > li { display: flex; }
.cf-resources-mega-menu :is(.rmm-trigger, .rmm-link) { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 0; border-radius: var(--button-radius, var(--radius, 10px)); background: transparent; color: var(--ink, #101828); font: inherit; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); font-weight: 700; line-height: 1.15; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background .16s ease; }
.cf-resources-mega-menu :is(.rmm-trigger, .rmm-link):hover { background: color-mix(in oklch, var(--ink, #101828) 6%, var(--surface, #ffffff)); }
.cf-resources-mega-menu .rmm-trigger[aria-expanded='true'] { background: color-mix(in oklch, var(--ink, #101828) 9%, var(--surface, #ffffff)); }
.cf-resources-mega-menu .rmm-trigger svg { transition: transform .2s var(--rmm-ease); }
.cf-resources-mega-menu .rmm-trigger[aria-expanded='true'] svg { transform: rotate(180deg); }
.cf-resources-mega-menu .rmm-count { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 10px; border-radius: 999px; background: var(--accent-fill, var(--accent, #2563eb)); color: var(--accent-fill-ink, var(--card, #ffffff)); font-size: .875rem; font-weight: 800; line-height: 1.2; }
.cf-resources-mega-menu .rmm-trigger .rmm-count { order: 1; }
.cf-resources-mega-menu .rmm-cta {
--rmm-bg: var(--button-bg, var(--cta, #dc2626));
--rmm-bg2: var(--button-bg-2, var(--cta-2, #b91c1c));
display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
min-height: 48px; padding: 0 20px; border: 0;
border-radius: var(--button-radius, var(--radius, 12px));
background: linear-gradient(oklch(from var(--rmm-bg) calc(l + .04) c h), oklch(from var(--rmm-bg2) calc(l - .02) c h));
color: var(--button-ink, var(--cta-ink, #ffffff));
font-family: var(--button-font, var(--font-display, inherit));
font-weight: var(--button-weight, 800);
text-transform: var(--button-case, none);
text-shadow: var(--button-text-shadow, none);
text-align: center; text-decoration: none; cursor: pointer;
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--rmm-bg) calc(l + .14) c h / .7), inset 0 -3px 0 oklch(from var(--rmm-bg) calc(l - .16) c h), 0 1px 2px oklch(from var(--rmm-shade) l c h / .3), 0 8px 16px -6px oklch(from var(--rmm-shade) l c h / .45));
transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.cf-resources-mega-menu .rmm-cta:not(:disabled):hover {
background: linear-gradient(oklch(from var(--rmm-bg) calc(l - .01) c h), oklch(from var(--rmm-bg2) calc(l - .07) c h));
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--rmm-bg) calc(l + .1) c h / .6), inset 0 -3px 0 oklch(from var(--rmm-bg) calc(l - .2) c h), 0 1px 2px oklch(from var(--rmm-shade) l c h / .35), 0 10px 18px -6px oklch(from var(--rmm-shade) l c h / .5));
}
.cf-resources-mega-menu .rmm-cta:not(:disabled):active {
transform: translateY(1px);
box-shadow: inset 0 2px 3px oklch(from var(--rmm-bg) calc(l - .22) c h / .55), inset 0 -2px 0 oklch(from var(--rmm-bg) calc(l - .16) c h), 0 1px 1px oklch(from var(--rmm-shade) l c h / .3);
}
.cf-resources-mega-menu .rmm-cta:disabled { cursor: not-allowed; opacity: .55; box-shadow: none; }
.cf-resources-mega-menu .rmm-cta--bar { flex: 0 0 auto; margin-inline-start: auto; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.15; white-space: nowrap; }
.cf-resources-mega-menu .rmm-cta-short { display: none; }
.cf-resources-mega-menu .rmm-cta--lg { width: 100%; min-height: 72px; padding: 12px 24px; }
.cf-resources-mega-menu .rmm-cta-label { font-size: clamp(1.125rem, 1.55vw, 1.375rem); line-height: 1.15; text-wrap: balance; }
.cf-resources-mega-menu .rmm-cta-sub { font-family: var(--font-body, inherit); font-size: .9375rem; font-weight: 600; line-height: 1.3; text-transform: none; text-wrap: pretty; }
.cf-resources-mega-menu .rmm-menu {
display: none; flex: 0 0 auto; place-items: center; width: 44px; height: 44px; border: 1px solid var(--button-2-border, transparent);
border-radius: var(--button-radius, var(--radius, 12px));
background: var(--button-2-bg, var(--secondary, #eef1f6));
color: var(--button-2-ink, var(--secondary-ink, #101828));
box-shadow: var(--button-2-shadow, inset 0 -2px 0 oklch(from var(--secondary, #eef1f6) calc(l - .1) c h), var(--shadow-sm, 0 1px 2px oklch(0.22 0.03 260 / .2)));
cursor: pointer; transition: background .16s ease;
}
.cf-resources-mega-menu .rmm-menu:hover { background: oklch(from var(--button-2-bg, var(--secondary, #eef1f6)) calc(l - .04) c h); }
.cf-resources-mega-menu .rmm-menu:active { transform: translateY(1px); }
.cf-resources-mega-menu .rmm-drop { position: absolute; top: 100%; left: 0; right: 0; z-index: 1; padding: 8px var(--rmm-gutter) 0; pointer-events: none; }
.cf-resources-mega-menu .rmm-drop[hidden] { display: none; }
.cf-resources-mega-menu .rmm-drop > .rmm-panel { pointer-events: auto; }
.cf-resources-mega-menu.is-inline .rmm-drop { position: static; padding: 16px var(--rmm-gutter) 32px; pointer-events: auto; }
.cf-resources-mega-menu .rmm-panel {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
grid-template-areas: 'head event' 'res event' 'start start';
gap: 24px 32px;
max-width: 1120px; margin-inline: auto;
padding: clamp(20px, 3vw, 32px);
background: var(--card, #ffffff);
border: 1px solid var(--card-border, oklch(from var(--ink, #101828) l c h / .12));
border-radius: var(--card-radius, var(--radius, 14px));
box-shadow: var(--card-shadow, var(--shadow-lg, 0 2px 4px oklch(0.22 0.03 260 / .22), 0 12px 24px -8px oklch(0.22 0.03 260 / .32)));
color: var(--ink, #101828);
}
@keyframes cf-rmm-in { from { opacity: .82; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cf-resources-mega-menu .rmm-panel, .cf-resources-mega-menu .rmm-panel > * { animation: cf-rmm-in .45s var(--rmm-ease) both; }
.cf-resources-mega-menu .rmm-panel > :nth-child(2) { animation-delay: .07s; }
.cf-resources-mega-menu .rmm-panel > :nth-child(3) { animation-delay: .14s; }
.cf-resources-mega-menu .rmm-panel > :nth-child(4) { animation-delay: .21s; }
.cf-resources-mega-menu .rmm-panel > :nth-child(5) { animation-delay: .28s; }
.cf-resources-mega-menu .rmm-head { grid-area: head; display: grid; align-content: start; gap: 8px; }
.cf-resources-mega-menu .rmm-h2 { color: var(--ink, #101828); font-family: var(--font-display, inherit); font-size: clamp(1.3125rem, 1.8vw, 1.625rem); font-weight: var(--display-weight, 800); letter-spacing: var(--display-tracking, -0.025em); text-transform: var(--display-case, none); line-height: 1.15; text-wrap: balance; }
.cf-resources-mega-menu .rmm-aside { max-width: 64ch; color: var(--muted, #475467); font-size: clamp(1.0625rem, 1.25vw, 1.125rem); font-style: normal; line-height: 1.5; text-wrap: pretty; }
.cf-resources-mega-menu .rmm-res-grid { grid-area: res; display: grid; grid-template-columns: repeat(var(--rmm-count, 3), minmax(0, 1fr)); gap: 16px; list-style: none; }
.cf-resources-mega-menu .rmm-res-grid > li { display: flex; }
.cf-resources-mega-menu .rmm-res {
--rmm-bg: var(--button-bg, var(--cta, #dc2626));
--rmm-bg2: var(--button-bg-2, var(--cta-2, #b91c1c));
display: flex; flex: 1; flex-direction: column; gap: 12px; width: 100%; padding: 12px; border: 0; border-radius: 12px; background: var(--rmm-well); color: var(--ink, #101828); font: inherit; text-align: left; text-decoration: none; cursor: pointer; transition: transform .16s ease, background .16s ease;
}
.cf-resources-mega-menu .rmm-res:hover { background: var(--rmm-well-hover); transform: translateY(-2px); }
.cf-resources-mega-menu .rmm-res:active { transform: translateY(0); }
.cf-resources-mega-menu .rmm-cover { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; background: var(--rmm-well-hover); }
.cf-resources-mega-menu .rmm-cover img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform .3s var(--rmm-ease); }
.cf-resources-mega-menu .rmm-res:hover .rmm-cover img { transform: scale(1.03); }
.cf-resources-mega-menu .rmm-res-body { display: grid; gap: 4px; padding-inline: 4px; }
.cf-resources-mega-menu .rmm-res-title { font-family: var(--font-display, inherit); font-size: clamp(1.0625rem, 1.25vw, 1.125rem); font-weight: var(--display-weight, 800); letter-spacing: -0.01em; line-height: 1.2; text-wrap: balance; }
.cf-resources-mega-menu .rmm-res-meta { color: var(--muted, #475467); font-size: .875rem; font-weight: 800; line-height: 1.2; }
.cf-resources-mega-menu .rmm-res-benefit { color: var(--muted, #475467); font-size: .9375rem; line-height: 1.4; text-wrap: pretty; }
.cf-resources-mega-menu .rmm-get {
display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: auto; padding: 0 16px;
border: 1px solid var(--button-2-border, transparent);
border-radius: var(--button-radius, var(--radius, 12px));
background: var(--button-2-bg, var(--secondary, #eef1f6));
color: var(--button-2-ink, var(--secondary-ink, #101828));
box-shadow: var(--button-2-shadow, inset 0 -2px 0 oklch(from var(--secondary, #eef1f6) calc(l - .1) c h), var(--shadow-sm, 0 1px 2px oklch(0.22 0.03 260 / .2)));
font-family: var(--button-font, var(--font-display, inherit)); font-size: .9375rem; font-weight: var(--button-weight, 800); text-transform: var(--button-case, none); line-height: 1.15; white-space: nowrap;
transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.cf-resources-mega-menu .rmm-res:hover .rmm-get {
background: linear-gradient(oklch(from var(--rmm-bg) calc(l + .04) c h), oklch(from var(--rmm-bg2) calc(l - .02) c h));
color: var(--button-ink, var(--cta-ink, #ffffff));
text-shadow: var(--button-text-shadow, none);
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--rmm-bg) calc(l + .14) c h / .7), inset 0 -2px 0 oklch(from var(--rmm-bg) calc(l - .16) c h), 0 1px 2px oklch(from var(--rmm-shade) l c h / .3));
}
.cf-resources-mega-menu .rmm-event { grid-area: event; display: flex; flex-direction: column; gap: 16px; padding: clamp(20px, 3vw, 28px); border-radius: var(--card-radius, var(--radius, 14px)); background: var(--band, #1e2a44); color: var(--band-ink, #ffffff); }
.cf-resources-mega-menu .rmm-when { display: flex; align-items: center; gap: 16px; }
.cf-resources-mega-menu .rmm-board { flex: 0 0 auto; min-width: 84px; padding: 10px 12px 8px; overflow: hidden; border-radius: 10px; background: oklch(from var(--band-ink, #ffffff) l c h / .12); font-family: var(--font-display, inherit); text-align: center; }
.cf-resources-mega-menu .rmm-board-month { display: block; font-size: .875rem; font-weight: var(--display-weight, 800); letter-spacing: .08em; line-height: normal; text-transform: uppercase; }
.cf-resources-mega-menu .rmm-board-day { position: relative; display: block; margin-top: 14px; font-size: 2.5rem; font-weight: var(--display-weight, 800); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: normal; }
.cf-resources-mega-menu .rmm-board-day::after { content: ''; position: absolute; left: -12px; right: -12px; top: 52%; height: 1px; background: oklch(from var(--band, #1e2a44) l c h / .55); }
.cf-resources-mega-menu .rmm-when-text { display: grid; gap: 8px; min-width: 0; }
.cf-resources-mega-menu .rmm-chip-band { justify-self: start; display: inline-flex; align-items: center; min-height: 28px; padding: 4px 12px; border-radius: 999px; background: oklch(from var(--band-ink, #ffffff) l c h / .12); font-size: .875rem; font-weight: 800; line-height: 1.2; }
.cf-resources-mega-menu .rmm-when-line { font-size: .9375rem; font-weight: 600; line-height: 1.4; }
.cf-resources-mega-menu .rmm-event-title { color: var(--band-ink, #ffffff); font-family: var(--font-display, inherit); font-size: clamp(1.3125rem, 1.8vw, 1.625rem); font-weight: var(--display-weight, 800); letter-spacing: var(--display-tracking, -0.025em); text-transform: var(--display-case, none); line-height: 1.15; text-wrap: balance; }
.cf-resources-mega-menu .rmm-event-lead { font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.5; text-wrap: pretty; }
.cf-resources-mega-menu .rmm-event-foot { display: grid; gap: 12px; margin-top: auto; padding-top: 8px; }
.cf-resources-mega-menu .rmm-privacy { font-size: .9375rem; font-weight: 500; line-height: 1.4; text-align: center; text-wrap: pretty; }
.cf-resources-mega-menu .rmm-nobr { white-space: nowrap; }
.cf-resources-mega-menu .rmm-privacy svg { display: inline-block; vertical-align: -0.15em; margin-inline-end: .4em; }
.cf-resources-mega-menu .rmm-start { grid-area: start; display: grid; gap: 16px; padding: 20px; border-radius: 12px; background: var(--rmm-well); }
.cf-resources-mega-menu .rmm-start-h { font-family: var(--font-display, inherit); font-size: clamp(1.0625rem, 1.25vw, 1.125rem); font-weight: var(--display-weight, 800); letter-spacing: -0.01em; line-height: 1.2; text-wrap: balance; }
.cf-resources-mega-menu .rmm-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; list-style: none; }
.cf-resources-mega-menu .rmm-steps > li { display: flex; }
.cf-resources-mega-menu .rmm-step { display: grid; flex: 1; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px; padding: 8px; border-radius: 10px; color: var(--ink, #101828); text-decoration: none; transition: background .16s ease; }
.cf-resources-mega-menu a.rmm-step:hover { background: var(--rmm-well-hover); }
.cf-resources-mega-menu a.rmm-step:hover .rmm-step-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .18em; }
.cf-resources-mega-menu .rmm-step-num { min-width: 1ch; color: var(--accent, #2563eb); font-family: var(--font-display, inherit); font-size: 2.5rem; font-weight: var(--display-weight, 800); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1; }
.cf-resources-mega-menu .rmm-step-text { display: block; padding-top: 2px; }
.cf-resources-mega-menu .rmm-step-title { display: block; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); font-weight: 800; line-height: 1.25; text-wrap: balance; }
.cf-resources-mega-menu .rmm-step-detail { display: block; margin-top: 4px; color: var(--muted, #475467); font-size: .9375rem; line-height: 1.4; text-wrap: pretty; }
.cf-resources-mega-menu .rmm-price { display: block; margin-top: 8px; }
.cf-resources-mega-menu .rmm-price-big { display: block; color: var(--ink, #101828); font-family: var(--font-display, inherit); font-size: clamp(1.125rem, 1.5vw, 1.375rem); font-weight: var(--display-weight, 800); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.15; }
.cf-resources-mega-menu .rmm-price-note { display: block; margin-top: 4px; color: var(--muted, #475467); font-size: .9375rem; font-weight: 600; line-height: 1.4; }
.cf-resources-mega-menu .rmm-mlinks { grid-area: links; display: none; list-style: none; }
.cf-resources-mega-menu .rmm-mlinks > li + li { border-top: 1px solid oklch(from var(--ink, #101828) l c h / .12); }
.cf-resources-mega-menu .rmm-mlinks a { display: flex; align-items: center; min-height: 52px; padding: 0 4px; color: var(--ink, #101828); font-size: clamp(1.0625rem, 1.25vw, 1.125rem); font-weight: 700; text-decoration: none; }
.cf-resources-mega-menu .rmm-mlinks a:hover { text-decoration: underline; text-underline-offset: .18em; }
@media (max-width: 1040px) {
.cf-resources-mega-menu .rmm-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: 'head head' 'res res' 'start event'; }
.cf-resources-mega-menu .rmm-steps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px) {
.cf-resources-mega-menu .rmm-bar-in { min-height: 64px; gap: 12px; }
.cf-resources-mega-menu .rmm-brand { font-size: 1.125rem; }
.cf-resources-mega-menu .rmm-links { display: none; }
.cf-resources-mega-menu .rmm-menu { display: inline-grid; }
.cf-resources-mega-menu .rmm-cta--bar { min-height: 44px; padding: 0 14px; }
.cf-resources-mega-menu .rmm-cta-long { display: none; }
.cf-resources-mega-menu .rmm-cta-short { display: inline; }
.cf-resources-mega-menu .rmm-drop { padding: 0; }
.cf-resources-mega-menu.is-inline .rmm-drop { padding: 12px var(--rmm-gutter) 24px; }
.cf-resources-mega-menu .rmm-panel { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'head' 'res' 'event' 'start' 'links'; gap: 20px; }
.cf-resources-mega-menu:not(.is-inline) .rmm-panel { max-height: calc(100dvh - 64px); overflow-y: auto; overscroll-behavior: contain; padding: 20px var(--rmm-gutter) 28px; border-width: 0 0 1px; border-radius: 0 0 var(--card-radius, var(--radius, 14px)) var(--card-radius, var(--radius, 14px)); }
.cf-resources-mega-menu .rmm-res-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.cf-resources-mega-menu .rmm-res { display: grid; grid-template-columns: 88px minmax(0, 1fr); grid-template-areas: 'cover body' 'cover get'; align-items: start; gap: 8px 16px; }
.cf-resources-mega-menu .rmm-res.no-cover { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'body' 'get'; }
.cf-resources-mega-menu .rmm-cover { grid-area: cover; aspect-ratio: 1 / 1; }
.cf-resources-mega-menu .rmm-res-body { grid-area: body; padding-inline: 0; }
.cf-resources-mega-menu .rmm-get { grid-area: get; justify-self: start; margin-top: 4px; }
.cf-resources-mega-menu .rmm-mlinks { display: grid; }
}
@media (max-width: 420px) {
.cf-resources-mega-menu .rmm-bar-in { gap: 8px; }
.cf-resources-mega-menu .rmm-brand { font-size: 1.0625rem; }
.cf-resources-mega-menu .rmm-cta--bar { padding: 0 12px; }
.cf-resources-mega-menu .rmm-cta--lg { padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) {
.cf-resources-mega-menu .rmm-panel, .cf-resources-mega-menu .rmm-panel > * { animation: none; }
.cf-resources-mega-menu .rmm-cta, .cf-resources-mega-menu .rmm-res, .cf-resources-mega-menu .rmm-cover img, .cf-resources-mega-menu .rmm-trigger svg, .cf-resources-mega-menu .rmm-get, .cf-resources-mega-menu .rmm-step, .cf-resources-mega-menu .rmm-menu, .cf-resources-mega-menu :is(.rmm-trigger, .rmm-link) { transition: none; }
.cf-resources-mega-menu .rmm-res:hover, .cf-resources-mega-menu .rmm-res:hover .rmm-cover img, .cf-resources-mega-menu .rmm-cta:not(:disabled):active, .cf-resources-mega-menu .rmm-menu:active { transform: none; }
}
`;
pieces/nav/resources-mega-menu/specimen.tsx 79 lines
import * as React from 'react';
import { ResourcesMegaMenu } from '../resources-mega-menu';
import defaults from '../../studio-defaults.json';
import { slot } from '../../slots';
export const states = ['default'];
export default function ResourcesMegaMenuSpecimen(_props: { state?: string }) {
const sample = defaults.sample;
const reg = sample.registration;
const [guide, workbook, checklist] = sample.items;
const logo = slot('logo', '');
return (
<ResourcesMegaMenu
brandName='Funnel Starter'
logoImage={logo || undefined}
links={[
{ label: 'How it works', href: '#how-it-works' },
{ label: 'The kit', href: '#kit' },
]}
resources={[
{
title: guide.name + ': Chapter 1',
kind: 'Free chapter',
meta: 'PDF',
benefit: guide.detail,
image: slot('item-1', guide.image),
imageAlt: guide.imageAlt,
href: '#free-chapter',
},
{
title: workbook.name + ': Headline Pages',
kind: 'Free pages',
meta: 'Printable',
benefit: workbook.detail,
image: slot('item-2', workbook.image),
imageAlt: workbook.imageAlt,
href: '#free-headline-pages',
},
{
title: checklist.name,
kind: 'Free checklist',
meta: 'Printable',
benefit: checklist.detail,
image: slot('item-3', checklist.image),
imageAlt: checklist.imageAlt,
href: '#free-checklist',
},
]}
event={{
kind: 'Free workshop',
title: reg.headline,
lead: reg.lead,
date: { month: 'Dec', day: '10', line: 'Thursday · 7pm ET' },
}}
steps={[
{ title: 'Watch the free workshop', detail: 'Map out your first funnel in one sitting.', href: '#workshop' },
{ title: 'Print the ' + checklist.name, detail: 'Check every link and form before you go live.', href: '#free-checklist' },
{
title: 'Get ' + sample.name,
detail: 'Guide, workbook and checklist in one download.',
price: sample.price + ' once',
priceNote: 'about $1.57 a day for a month',
href: '#kit',
},
]}
actionLabel={reg.label}
actionSublabel={reg.sublabel}
barActionShortLabel='Save My Seat'
href='#workshop'
overlay={false}
defaultOpen
copy={{
aside: '(Start with the checklist. It’s the one page I wish I’d had before my first launch.)',
privacy: reg.privacy,
}}
/>
);
}
| Name | Type | Details |
|---|---|---|
brandName OptionalResourcesMegaMenu |
string |
|
brandHref OptionalResourcesMegaMenu |
string |
|
logoImage OptionalResourcesMegaMenu |
string |
|
logoAlt OptionalResourcesMegaMenu |
string |
|
links OptionalResourcesMegaMenu |
MegaMenuLink[] |
|
resources OptionalResourcesMegaMenu |
MegaMenuResource[] |
|
event OptionalResourcesMegaMenu |
MegaMenuEvent |
|
steps OptionalResourcesMegaMenu |
MegaMenuStep[] |
|
actionLabel OptionalResourcesMegaMenu |
string |
|
actionSublabel OptionalResourcesMegaMenu |
string |
|
barActionLabel OptionalResourcesMegaMenu |
string |
|
barActionShortLabel OptionalResourcesMegaMenu |
string |
|
href OptionalResourcesMegaMenu |
string |
|
onAction OptionalResourcesMegaMenu |
(event: React.MouseEvent<HTMLElement>) => void |
|
onResourceAction OptionalResourcesMegaMenu |
(resource: MegaMenuResource, index: number, event: React.MouseEvent<HTMLElement>) => void |
|
actionDisabled OptionalResourcesMegaMenu |
boolean |
|
sticky OptionalResourcesMegaMenu |
boolean |
|
overlay OptionalResourcesMegaMenu |
boolean |
|
defaultOpen OptionalResourcesMegaMenu |
boolean |
|
onOpenChange OptionalResourcesMegaMenu |
(open: boolean) => void |
|
copy OptionalResourcesMegaMenu |
Partial<ResourcesMegaMenuCopy> |
|
className OptionalResourcesMegaMenu |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-border--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field-focus- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-1- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-2- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-3- One image per offer item (item-1, item-2…), shown in stacks and lists.
logo- The brand’s logo mark.
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB