Calendar Actions 1
Google, Outlook and .ics built from real event data, with the exact date, time and timezone printed beside them.
Use it in a prompt
Use checkout/calendar-actions 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/checkout/calendar-actions.tsx. - Import it and pass your copy and images (Props tab):
import { CalendarActions } from "@/components/funneldna/checkout/calendar-actions"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/calendar-actions/component.tsx 374 lines
// Turns a confirmed registration into a calendar reminder with explicit event details.
'use client'
import * as React from 'react'
import { BellRing } from 'lucide-react'
export type CalendarActionsProps = {
/** Generated labels use {title}, {date}, {provider} or {city}; substitutions stay plain text. */
copy?: Partial<CalendarActionsCopy>
/** Locale for the event's generated month, weekday, date and time labels. */
locale?: string
onAction?: (provider: Provider, event: React.MouseEvent<HTMLAnchorElement>) => void
/** "success" is accepted for older callers and renders as default. */
state?: DemoState
eyebrow?: React.ReactNode
heading?: React.ReactNode
lead?: React.ReactNode
/** The event title as it should appear in their calendar. */
title: string
/** ISO 8601 with zone info, e.g. "2026-03-04T19:00:00Z". */
startsAt: string
/** Defaults to one hour after start. */
endsAt?: string
/** IANA zone the event is announced in, e.g. "America/New_York". */
timezone: string
/** A URL for online events, a venue otherwise. */
location?: string
description?: string
/** e.g. "You’ll also get an email reminder 24 hours before." */
note?: React.ReactNode
/** Called when a calendar option is chosen; call event.preventDefault() to keep the visitor on the page. */
onSelect?: (provider: Provider, event: React.MouseEvent<HTMLAnchorElement>) => void
/** Studio preview only: show the Google option hovered, pressed, or chosen. */
demoState?: DemoState
className?: string
}
export function CalendarActions({
copy: copyOverrides,
locale = 'en-US',
onAction,
state,
eyebrow = 'Don’t miss it',
heading = (
<>
Add it to your <span className='cfca-mark'>calendar</span>
</>
),
lead = 'One click and it’s saved, so it’s waiting for you the moment it starts.',
title,
startsAt,
endsAt,
timezone,
location,
description,
note,
onSelect,
demoState: legacyState = 'default',
className,
}: CalendarActionsProps) {
const copy = { ...CALENDAR_COPY, ...Object.fromEntries(Object.entries(copyOverrides ?? {}).filter(([, value]) => value !== undefined)) }
const demoState = state !== undefined ? state : legacyState
const action = onAction !== undefined ? onAction : onSelect
const start = new Date(startsAt)
if (Number.isNaN(start.getTime())) return null
const parsedEnd = endsAt ? new Date(endsAt) : null
const end = parsedEnd && !Number.isNaN(parsedEnd.getTime()) ? parsedEnd : new Date(start.getTime() + 60 * 60 * 1000)
const fmt = (opts: Intl.DateTimeFormatOptions, date: Date = start) =>
new Intl.DateTimeFormat(locale, { timeZone: timezone, ...opts }).format(date)
const month = fmt({ month: 'short' }).toUpperCase()
const day = fmt({ day: 'numeric' })
const weekday = fmt({ weekday: 'short' })
const dateLine = fmt({ weekday: 'long', month: 'long', day: 'numeric', year: 'numeric' })
const timeLine = `${fmt({ hour: 'numeric', minute: '2-digit' })} – ${fmt({ hour: 'numeric', minute: '2-digit' }, end)}`
const tzShort =
new Intl.DateTimeFormat(locale, { timeZone: timezone, timeZoneName: 'short' })
.formatToParts(start)
.find((part) => part.type === 'timeZoneName')?.value ?? ''
const city = (timezone.split('/').pop() || timezone).replace(/_/g, ' ')
const googleHref =
'https://calendar.google.com/calendar/render?action=TEMPLATE' +
`&text=${encodeURIComponent(title)}` +
`&dates=${toBasicUtc(start)}/${toBasicUtc(end)}` +
`&ctz=${encodeURIComponent(timezone)}` +
(location ? `&location=${encodeURIComponent(location)}` : '') +
(description ? `&details=${encodeURIComponent(description)}` : '')
const outlookHref =
'https://outlook.live.com/calendar/0/action/compose?rru=addevent' +
`&subject=${encodeURIComponent(title)}` +
`&startdt=${encodeURIComponent(start.toISOString())}` +
`&enddt=${encodeURIComponent(end.toISOString())}` +
(location ? `&location=${encodeURIComponent(location)}` : '') +
(description ? `&body=${encodeURIComponent(description)}` : '')
const ics = [
'BEGIN:VCALENDAR',
'VERSION:2.0',
'PRODID:-//funnel//calendar-actions//EN',
'BEGIN:VEVENT',
`UID:${toBasicUtc(start)}-${slugify(title)}`,
`DTSTAMP:${toBasicUtc(start)}`,
`DTSTART:${toBasicUtc(start)}`,
`DTEND:${toBasicUtc(end)}`,
`SUMMARY:${escapeIcs(title)}`,
...(location ? [`LOCATION:${escapeIcs(location)}`] : []),
...(description ? [`DESCRIPTION:${escapeIcs(description)}`] : []),
'END:VEVENT',
'END:VCALENDAR',
].join(CRLF)
const icsHref = `data:text/calendar;charset=utf-8,${encodeURIComponent(ics)}`
const options: Array<{
id: Provider
label: string
aria: string
href: string
icon: React.ReactNode
external: boolean
}> = [
{ id: 'google', label: copy.googleLabel, aria: formatCopy(copy.googleAction, { title }), href: googleHref, icon: <GoogleMark />, external: true },
{ id: 'outlook', label: copy.outlookLabel, aria: formatCopy(copy.outlookAction, { title }), href: outlookHref, icon: <OutlookMark />, external: true },
{ id: 'ics', label: copy.icsLabel, aria: formatCopy(copy.icsAction, { title }), href: icsHref, icon: <IcsMark />, external: false },
]
const handle = (provider: Provider) => (event: React.MouseEvent<HTMLAnchorElement>) => {
action?.(provider, event)
}
return (
<div className={cx('cf-calendar-actions', className)} data-state={demoState}>
<style>{CSS}</style>
{eyebrow ? <p className='cfca-eyebrow'>{eyebrow}</p> : null}
<h2 className='cfca-heading'>{heading}</h2>
{lead ? <p className='cfca-lead'>{lead}</p> : null}
<section className='cfca-event' aria-label={copy.eventDetails}>
<div className='cfca-event-head'>
<div className='cfca-leaf' aria-hidden='true'>
<span className='cfca-leaf-month' suppressHydrationWarning>{month}</span>
<span className='cfca-leaf-day' suppressHydrationWarning>{day}</span>
<span className='cfca-leaf-week' suppressHydrationWarning>{weekday}</span>
</div>
<div className='cfca-head-text'>
<p className='cfca-title'>{title}</p>
<p className='cfca-date-line' suppressHydrationWarning>{dateLine}</p>
</div>
</div>
<dl className='cfca-facts'>
<div className='cfca-fact cfca-fact--time'>
<dt>{copy.timeLabel}</dt>
<dd suppressHydrationWarning>{timeLine}</dd>
</div>
<div className='cfca-fact'>
<dt>{copy.timezoneLabel}</dt>
<dd suppressHydrationWarning>
{tzShort ? <span className='cfca-zone-code'>{tzShort}</span> : null}
{tzShort ? ' · ' : ''}
{formatCopy(copy.cityTime, { city })}
</dd>
</div>
{location ? (
<div className='cfca-fact'>
<dt>{copy.locationLabel}</dt>
<dd>{location}</dd>
</div>
) : null}
</dl>
</section>
<div className='cfca-pick'>
<span className='cfca-pick-label'>{copy.pickLabel}</span>
</div>
<div className='cfca-tiles'>
{options.map((option) => (
<a
key={option.id}
className={cx(
'cfca-tile',
option.id === 'google' && demoState === 'hover' && 'is-hover',
option.id === 'google' && demoState === 'active' && 'is-press',
)}
href={option.href}
aria-label={option.aria}
onClick={handle(option.id)}
{...(option.external
? { target: '_blank', rel: 'noopener noreferrer' }
: { download: `${slugify(title)}.ics` })}
>
<span className='cfca-tile-icon'>{option.icon}</span>
<span className='cfca-tile-label'>{option.label}</span>
</a>
))}
</div>
<p className='cfca-hint'>{copy.hint}</p>
{note ? (
<p className='cfca-note'>
<BellRing aria-hidden='true' />
<span>{note}</span>
</p>
) : null}
</div>
)
}
type Provider = 'google' | 'outlook' | 'ics'
type DemoState = 'default' | 'hover' | 'active' | 'success'
const BS = String.fromCharCode(92)
const LF = String.fromCharCode(10)
const CRLF = String.fromCharCode(13, 10)
/** 2026-03-04T19:00:00.000Z → 20260304T190000Z (the basic format calendars want). */
function toBasicUtc(date: Date) {
return date.toISOString().slice(0, 19).replace(/[-:]/g, '') + 'Z'
}
function escapeIcs(text: string) {
return text
.split(BS).join(BS + BS)
.split(';').join(BS + ';')
.split(',').join(BS + ',')
.split(LF).join(BS + 'n')
}
function slugify(text: string) {
return text.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'event'
}
function cx(...parts: Array<string | false | null | undefined>) {
return parts.filter(Boolean).join(' ')
}
// Official Google and Outlook marks retain their provider colours.
function GoogleMark() {
return (
<svg viewBox='0 0 48 48' width='28' height='28' aria-hidden='true' focusable='false' data-official-mark='Google'>
<path fill='#FBBC05' d='M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917z' />
<path fill='#EA4335' d='M6.306 14.691l6.571 4.819C14.655 15.108 18.961 12 24 12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 16.318 4 9.656 8.337 6.306 14.691z' />
<path fill='#34A853' d='M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238C29.211 35.091 26.715 36 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44z' />
<path fill='#4285F4' d='M43.611 20.083H42V20H24v8h11.303c-.792 2.237-2.231 4.166-4.087 5.571l.003-.002 6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917z' />
</svg>
)
}
function OutlookMark() {
const raw = React.useId()
const id = 'cfcaol' + raw.replace(/[^a-zA-Z0-9_-]/g, '')
return (
<svg viewBox='0 0 48 48' width='28' height='28' aria-hidden='true' focusable='false' data-official-mark='Microsoft Outlook'>
<defs>
<linearGradient id={id + 'e'} x1='0' y1='0' x2='0' y2='1'>
<stop offset='0' stopColor='#3CC0F5' />
<stop offset='1' stopColor='#1490DF' />
</linearGradient>
<linearGradient id={id + 't'} x1='0' y1='0' x2='1' y2='1'>
<stop offset='0' stopColor='#1C8BE0' />
<stop offset='1' stopColor='#0A54A0' />
</linearGradient>
</defs>
<rect x='16' y='10' width='28' height='28' rx='3.5' fill={`url(#${id}e)`} />
<path d='M17.5 13.5 30 23.2l12.5-9.7' fill='none' stroke='#ffffff' strokeOpacity='0.9' strokeWidth='2.4' strokeLinecap='round' strokeLinejoin='round' />
<rect x='4' y='12' width='24' height='24' rx='4' fill={`url(#${id}t)`} />
<ellipse cx='16' cy='24' rx='5.4' ry='6.6' fill='none' stroke='#ffffff' strokeWidth='3.4' />
</svg>
)
}
// Generic calendar-file icon: every colour comes from the theme tokens.
function IcsMark() {
return (
<svg viewBox='0 0 48 48' width='28' height='28' aria-hidden='true' focusable='false'>
<rect x='7' y='9' width='34' height='32' rx='5.5' fill='var(--card,#ffffff)' stroke='oklch(from var(--ink,#101828) l c h / 0.28)' strokeWidth='1.5' />
<path d='M7 14.5A5.5 5.5 0 0 1 12.5 9h23A5.5 5.5 0 0 1 41 14.5V18H7z' fill='var(--accent-fill,var(--accent,#0f5fc2))' />
<rect x='14' y='5' width='3.4' height='9' rx='1.7' fill='var(--ink,#101828)' />
<rect x='30.6' y='5' width='3.4' height='9' rx='1.7' fill='var(--ink,#101828)' />
<path d='M24 23.5v10.5M19.2 29.4 24 34.2l4.8-4.8' fill='none' stroke='var(--ink,#101828)' strokeWidth='3' strokeLinecap='round' strokeLinejoin='round' />
</svg>
)
}
const CSS = `
.cf-calendar-actions{--cfca-accent:var(--accent,#0f5fc2);--cfca-ink:var(--ink,#101828);--cfca-muted:var(--muted,#4a5565);--cfca-surface:var(--surface,#ffffff);--cfca-band:var(--band,#0f2747);--cfca-cta:var(--cta,#d92d20);--cfca-cta-ink:var(--cta-ink,#ffffff);--cfca-panel:var(--card);--cfca-lt-ink:var(--ink);--cfca-lt-muted:var(--muted);--cfca-deep:var(--ink);--cfca-line:var(--card-border,oklch(from var(--ink) l c h / 0.12));
--cfca-shadow:var(--shadow,oklch(0.22 0.03 260));
--cfca-tile-line:oklch(from var(--ink,#101828) l c h / 0.16);
--cfca-tile-line-hover:oklch(from var(--accent,#0f5fc2) l c h / 0.7);
--cfca-tile-sheen:inset 0 1px 0 oklch(from var(--card,#ffffff) calc(l + 0.04) c h / 0.6);
--cfca-tile-shadow:var(--shadow-sm,0 1px 1px oklch(from var(--cfca-shadow) l c h / 0.18),0 1px 3px oklch(from var(--cfca-shadow) l c h / 0.14));
--cfca-tile-shadow-lift:var(--shadow-md,0 1px 2px oklch(from var(--cfca-shadow) l c h / 0.22),0 4px 10px -2px oklch(from var(--cfca-shadow) l c h / 0.2));
position:relative;box-sizing:border-box;width:100%;max-width:36rem;margin-inline:auto;padding:clamp(1.25rem,4.5vw,2.25rem);border-radius:var(--card-radius,var(--radius,var(--radius,20px)));color:var(--cfca-ink);font-family:var(--font-body,Arial,sans-serif);background:var(--card);border:1px solid var(--cfca-line);box-shadow:var(--card-shadow,var(--shadow-md, 0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22), 0 4px 10px -2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.2)));isolation:isolate;border-color:var(--card-border,oklch(from var(--ink) l c h / 0.16))}
.cf-calendar-actions *,.cf-calendar-actions *::before,.cf-calendar-actions *::after{box-sizing:border-box}
:where(.cf-calendar-actions) .cfca-eyebrow{display:flex;align-items:center;gap:.55rem;margin:0 0 .8rem;font:800 13px/1.2 var(--font-display,Arial,sans-serif);letter-spacing:.12em;text-transform:uppercase;color:var(--cfca-deep)}
:where(.cf-calendar-actions) .cfca-eyebrow::before{content:'';flex:none;width:1.25rem;height:3px;border-radius:2px;background:var(--band)}
:where(.cf-calendar-actions) .cfca-heading{margin:0 0 .75rem;font-family:var(--font-display);font-size:clamp(1.75rem,5vw,2.35rem);font-weight:var(--display-weight,900);line-height:1.1;letter-spacing:var(--display-tracking,-.02em);text-wrap:balance;color:var(--cfca-ink);text-transform:var(--display-case,none)}
:where(.cf-calendar-actions) .cfca-mark{position:relative;display:inline-block;white-space:nowrap}
:where(.cf-calendar-actions) .cfca-mark::after{content:'';position:absolute;left:-.03em;right:-.05em;bottom:.02em;height:.4em;background:oklch(from var(--marker,#fae37c) l c h / 0.28);z-index:-1;pointer-events:none}
:where(.cf-calendar-actions) .cfca-lead{margin:0;max-width:44ch;font-size:17px;line-height:1.5;color:var(--cfca-muted)}
:where(.cf-calendar-actions) .cfca-event{margin-top:1.5rem;border-radius:var(--card-radius,var(--radius,14px));background:color-mix(in oklch,var(--ink) 4%,var(--card));border:1px solid oklch(from var(--ink) l c h / 0.08)}
:where(.cf-calendar-actions) .cfca-event-head{display:flex;align-items:center;gap:1rem;padding:1.1rem 1.15rem}
:where(.cf-calendar-actions) .cfca-leaf{flex:none;width:4.25rem;border-radius:var(--card-radius,var(--radius,10px));overflow:hidden;background:var(--card);text-align:center;box-shadow:var(--card-shadow,0 0 0 1px oklch(from var(--ink) l c h / 0.14),0 3px 6px -1px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24));border-color:var(--card-border,oklch(from var(--ink) l c h / 0.16))}
:where(.cf-calendar-actions) .cfca-leaf-month{display:block;padding:.38rem 0 .32rem;background:var(--band);color:var(--band-ink);font:800 13px/1 var(--font-display,Arial,sans-serif);letter-spacing:.14em}
:where(.cf-calendar-actions) .cfca-leaf-day{display:block;padding:.4rem 0 .1rem;font:900 1.85rem/1 var(--font-display,Arial,sans-serif);letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--cfca-lt-ink)}
:where(.cf-calendar-actions) .cfca-leaf-week{display:block;padding-bottom:.45rem;font:700 13px/1.2 var(--font-display,Arial,sans-serif);letter-spacing:.08em;text-transform:uppercase;color:var(--cfca-lt-muted)}
:where(.cf-calendar-actions) .cfca-head-text{min-width:0}
:where(.cf-calendar-actions) .cfca-title{margin:0 0 .3rem;font-family:var(--font-display);font-size:1.25rem;font-weight:var(--display-weight,800);line-height:1.2;letter-spacing:var(--display-tracking,-.01em);text-wrap:balance;overflow-wrap:anywhere;color:var(--cfca-ink);text-transform:var(--display-case,none)}
:where(.cf-calendar-actions) .cfca-date-line{margin:0;font-size:15.5px;line-height:1.4;color:var(--cfca-muted)}
:where(.cf-calendar-actions) .cfca-facts{margin:0;padding:0 1.15rem;border-top:1px solid var(--cfca-line)}
:where(.cf-calendar-actions) .cfca-fact{display:grid;grid-template-columns:5.75rem minmax(0,1fr);gap:.75rem;align-items:baseline;padding:.75rem 0;border-top:1px solid oklch(from var(--cfca-band) l c h / 0.08)}
:where(.cf-calendar-actions) .cfca-fact:first-child{border-top:0}
:where(.cf-calendar-actions) .cfca-fact dt{font:800 13px/1.3 var(--font-display,Arial,sans-serif);letter-spacing:.08em;text-transform:uppercase;color:var(--cfca-muted)}
:where(.cf-calendar-actions) .cfca-fact dd{margin:0;font-size:15.5px;line-height:1.4;color:var(--cfca-ink);overflow-wrap:anywhere}
:where(.cf-calendar-actions) .cfca-fact--time dd{font-weight:800;font-variant-numeric:tabular-nums}
:where(.cf-calendar-actions) .cfca-zone-code{font-weight:800}
:where(.cf-calendar-actions) .cfca-pick{margin:1.6rem 0 .8rem}
:where(.cf-calendar-actions) .cfca-pick-label{font:900 14px/1.1 var(--font-display,Arial,sans-serif);letter-spacing:.08em;text-transform:uppercase;color:var(--cfca-ink)}
:where(.cf-calendar-actions) .cfca-tiles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.7rem}
:where(.cf-calendar-actions) .cfca-tile{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.6rem;min-width:0;min-height:6.5rem;padding:1rem .6rem .95rem;border-radius:min(var(--card-radius,var(--radius,14px)),18px);border:1px solid var(--cfca-tile-line);background:var(--card,#ffffff);color:var(--ink,#101828);text-decoration:none;text-align:center;font-family:var(--button-font,var(--font-display,Arial,sans-serif));font-weight:var(--button-weight,800);font-size:15px;line-height:1.2;text-transform:var(--button-case,none);cursor:pointer;-webkit-tap-highlight-color:transparent;box-shadow:var(--cfca-tile-sheen),var(--cfca-tile-shadow);transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease,background-color .18s ease}
:where(.cf-calendar-actions) .cfca-tile-icon{display:grid;place-items:center;width:3rem;height:3rem;background:transparent;transition:transform .2s ease}
:where(.cf-calendar-actions) .cfca-tile-icon svg{display:block;filter:drop-shadow(0 1px 1.5px oklch(from var(--cfca-shadow) l c h / 0.28))}
:where(.cf-calendar-actions) .cfca-tile-label{max-width:100%;white-space:nowrap;color:inherit}
@media (hover:hover){:where(.cf-calendar-actions) .cfca-tile:hover{transform:translateY(-2px);border-color:var(--cfca-tile-line-hover);background:color-mix(in oklch,var(--ink,#101828) 3%,var(--card,#ffffff));box-shadow:var(--cfca-tile-sheen),var(--cfca-tile-shadow-lift)}:where(.cf-calendar-actions) .cfca-tile:hover .cfca-tile-icon{transform:scale(1.07)}}
:where(.cf-calendar-actions) .cfca-tile.is-hover{transform:translateY(-2px);border-color:var(--cfca-tile-line-hover);background:color-mix(in oklch,var(--ink,#101828) 3%,var(--card,#ffffff));box-shadow:var(--cfca-tile-sheen),var(--cfca-tile-shadow-lift)}
:where(.cf-calendar-actions) .cfca-tile.is-hover .cfca-tile-icon{transform:scale(1.07)}
:where(.cf-calendar-actions) .cfca-tile:active,:where(.cf-calendar-actions) .cfca-tile.is-press{transform:translateY(1px);border-color:var(--cfca-tile-line-hover);background:color-mix(in oklch,var(--ink,#101828) 6%,var(--card,#ffffff));box-shadow:inset 0 1px 2px oklch(from var(--cfca-shadow) l c h / 0.16)}
:where(.cf-calendar-actions) .cfca-tile:active .cfca-tile-icon,:where(.cf-calendar-actions) .cfca-tile.is-press .cfca-tile-icon{transform:scale(.96)}
:where(.cf-calendar-actions) .cfca-tile:focus-visible{outline:3px solid var(--field-focus,var(--cfca-accent));outline-offset:3px}
:where(.cf-calendar-actions) .cfca-hint{margin:.9rem auto 0;max-width:42ch;text-align:center;font-size:14px;line-height:1.5;color:var(--cfca-muted);text-wrap:balance}
:where(.cf-calendar-actions) .cfca-note{display:flex;align-items:flex-start;justify-content:center;gap:.5rem;margin:1.15rem 0 0;padding-top:1.1rem;border-top:1px solid var(--cfca-line);font-size:15px;line-height:1.5;color:var(--cfca-muted);text-align:left}
:where(.cf-calendar-actions) .cfca-note svg{flex:none;width:17px;height:17px;margin-top:2px;color:var(--cfca-deep)}
@media (max-width:30rem){:where(.cf-calendar-actions) .cfca-event-head{gap:.85rem;padding:1rem}:where(.cf-calendar-actions) .cfca-leaf{width:3.75rem}:where(.cf-calendar-actions) .cfca-leaf-day{font-size:1.6rem}:where(.cf-calendar-actions) .cfca-title{font-size:1.12rem}:where(.cf-calendar-actions) .cfca-date-line{font-size:15px}:where(.cf-calendar-actions) .cfca-facts{padding:0 1rem}:where(.cf-calendar-actions) .cfca-fact{grid-template-columns:4.9rem minmax(0,1fr);gap:.6rem}:where(.cf-calendar-actions) .cfca-fact dd{font-size:15px}:where(.cf-calendar-actions) .cfca-tiles{gap:.5rem}:where(.cf-calendar-actions) .cfca-tile{min-height:5.75rem;padding:.85rem .4rem .8rem;font-size:14px;gap:.5rem}:where(.cf-calendar-actions) .cfca-tile-icon{width:2.65rem;height:2.65rem}:where(.cf-calendar-actions) .cfca-tile-done{top:.35rem;right:.35rem;width:1.25rem;height:1.25rem}}
@media (prefers-reduced-motion:reduce){.cf-calendar-actions *,.cf-calendar-actions *::before,.cf-calendar-actions *::after{animation:none!important;transition:none!important}:where(.cf-calendar-actions) .cfca-tile:hover,:where(.cf-calendar-actions) .cfca-tile.is-hover,:where(.cf-calendar-actions) .cfca-tile:active,:where(.cf-calendar-actions) .cfca-tile.is-press,:where(.cf-calendar-actions) .cfca-tile:hover .cfca-tile-icon,:where(.cf-calendar-actions) .cfca-tile.is-hover .cfca-tile-icon,:where(.cf-calendar-actions) .cfca-tile:active .cfca-tile-icon,:where(.cf-calendar-actions) .cfca-tile.is-press .cfca-tile-icon{transform:none}}
`
export default CalendarActions
const CALENDAR_COPY = {
googleLabel: 'Google',
outlookLabel: 'Outlook',
icsLabel: '.ics file',
googleName: 'Google Calendar',
outlookName: 'Outlook',
googleAction: 'Add “{title}” to Google Calendar (opens in a new tab)',
outlookAction: 'Add “{title}” to Outlook (opens in a new tab)',
icsAction: 'Download “{title}” as an .ics file for Apple Calendar and other apps',
/** @deprecated No longer rendered. */
icsStatus: 'Your .ics file is on its way. Open it to save “{title}” for {date}.',
/** @deprecated No longer rendered. */
providerStatus: '{provider} is open in a new tab. Hit Save and “{title}” is set for {date}.',
eventDetails: 'Event details',
timeLabel: 'Time',
timezoneLabel: 'Time zone',
locationLabel: 'Where',
pickLabel: 'Pick your calendar',
cityTime: '{city} time',
hint: 'Google and Outlook open in a new tab. The .ics file works with Apple Calendar and most other apps.',
}
type CalendarActionsCopy = typeof CALENDAR_COPY
function formatCopy(template: string, values: Record<string, string>) {
return template.replace(/\{(\w+)\}/g, (match, key: string) => values[key] ?? match)
}
pieces/checkout/calendar-actions/specimen.tsx 60 lines
'use client'
import * as React from 'react'
import { CalendarActions } from '../calendar-actions'
import defaults from '../../studio-defaults.json'
export const states = ['default', 'hover', 'active']
const sample = defaults.sample
/**
* Example event data for the preview only. The date and time are sample
* values so the formatter has something real to print; a page supplies its
* own event. Nothing here is a deadline or an announced session.
*/
const EXAMPLE_EVENT = {
title: sample.registration.name,
startsAt: '2027-03-04T19:00:00Z',
endsAt: '2027-03-04T20:00:00Z',
timezone: 'America/New_York',
location: 'Online workshop',
description: sample.registration.lead,
}
type DemoState = 'default' | 'hover' | 'active'
export default function CalendarActionsSpecimen({ state = 'default' }: { state?: string }) {
const demoState: DemoState =
state === 'hover' || state === 'active' ? state : 'default'
return (
<div
data-state={state}
style={
{
color: 'var(--ink, #101828)',
padding: '2.5rem 1rem',
boxSizing: 'border-box',
width: '100%',
} as React.CSSProperties
}
>
<CalendarActions
title={EXAMPLE_EVENT.title}
startsAt={EXAMPLE_EVENT.startsAt}
endsAt={EXAMPLE_EVENT.endsAt}
timezone={EXAMPLE_EVENT.timezone}
location={EXAMPLE_EVENT.location}
description={EXAMPLE_EVENT.description}
note='Bring your offer idea and a notebook.'
state={demoState}
onAction={(_provider, event) => {
// Studio preview: never open a tab or download a file.
event.preventDefault()
}}
/>
</div>
)
}
| Name | Type | Details |
|---|---|---|
copy OptionalCalendarActions |
Partial<CalendarActionsCopy> |
|
locale OptionalCalendarActions |
string |
Default 'en-US'
|
onAction OptionalCalendarActions |
(provider: Provider, event: React.MouseEvent<HTMLAnchorElement>) => void |
|
state OptionalCalendarActions |
DemoState |
|
eyebrow OptionalCalendarActions |
React.ReactNode |
Default 'Don’t miss it'
|
heading OptionalCalendarActions |
React.ReactNode |
Default (
<>
Add it to your <span className='cfca-mark'>calendar</span>
</>
)
|
lead OptionalCalendarActions |
React.ReactNode |
Default 'One click and it’s saved, so it’s waiting for you the moment it starts.'
|
title RequiredCalendarActions |
string |
|
startsAt RequiredCalendarActions |
string |
|
endsAt OptionalCalendarActions |
string |
|
timezone RequiredCalendarActions |
string |
|
location OptionalCalendarActions |
string |
|
description OptionalCalendarActions |
string |
|
note OptionalCalendarActions |
React.ReactNode |
|
onSelect OptionalCalendarActions |
(provider: Provider, event: React.MouseEvent<HTMLAnchorElement>) => void |
|
demoState OptionalCalendarActions |
DemoState |
Default 'default'
|
className OptionalCalendarActions |
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-case--button-font--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--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.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
This piece reads no image slots.
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB