Order Help 2
Answer-first order help: searchable top order questions on an angled dark stage beside a short
Use it in a prompt
Use checkout/order-help-2 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/order-help-2.tsx. - Import it and pass your copy and images (Props tab):
import { OrderHelp2 } from "@/components/funneldna/checkout/order-help-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/order-help-2/component.tsx 686 lines
// layout: diagonal-split
// Answer-first order help: searchable top order questions on an angled dark stage beside a short
// "still stuck?" form, so buyers fix most order problems themselves and the rest reach the team with an order number.
import * as React from "react"
import { AlertCircle, Check, Clock, Loader2, Plus, Search, SearchX, X } from "lucide-react"
import { Texture } from "../fx/fx"
import leak from "../fx/textures/leak"
/** One top order question with its answer. */
export type OrderHelpQuestion = {
id?: string
question: string
/** Plain-text answers are searchable; rich answers should also pass keywords. */
answer: React.ReactNode
/** Groups questions into the topic filters ("Returns", "Sizing"). */
topic?: string
/** Extra search words that are not in the question or answer. */
keywords?: string
/** Optional deflection link under the answer ("Start a return"). */
actionLabel?: string
actionHref?: string
}
export type OrderHelpValues = { orderNumber: string; email: string; message: string }
export type OrderHelp2Copy = {
searchLabel: string
searchPlaceholder: string
clearLabel: string
topicsLabel: string
allTopics: string
/** "{count}" is replaced by the number of questions. */
countAll: string
countOne: string
/** "{count}" is replaced by the number of matches. */
countMany: string
countNone: string
/** "{query}" is replaced by the visitor's search. */
noMatchTitle: string
noMatchText: string
noMatchLink: string
orderLabel: string
orderHint: string
orderPlaceholder: string
emailLabel: string
emailPlaceholder: string
messageLabel: string
messagePlaceholder: string
orderRequired: string
orderInvalid: string
emailRequired: string
emailInvalid: string
messageRequired: string
pendingLabel: string
}
export type OrderHelp2Props = {
headline?: string
lead?: string
questions?: OrderHelpQuestion[]
/** Index of the question open on load; -1 keeps every answer closed. */
defaultOpen?: number
deskTitle?: string
deskLead?: string
/** The supplied reply time, shown above the form. Empty hides it. */
replyTime?: string
/** Transparent product cut-out above the form (slot: product). */
deskImage?: string
deskImageAlt?: string
/** Regular-expression source an order number must match (case-insensitive). */
orderPattern?: string
submitLabel?: string
/** Benefit line inside the button, under the action. */
submitSublabel?: string
/** P.S. line under the button; empty hides it. */
ps?: string
defaultValues?: Partial<OrderHelpValues>
/** Called with validated values; return a promise to show the sending state. */
onSubmit?: (values: OrderHelpValues) => void | Promise<void>
/** Called when an answer's link is clicked. */
onAction?: (question: OrderHelpQuestion, event: React.MouseEvent<HTMLAnchorElement>) => void
copy?: Partial<OrderHelp2Copy>
state?: "default" | "hover" | "active" | "disabled" | "error"
className?: string
}
const DEFAULT_COPY: OrderHelp2Copy = {
searchLabel: "Search order questions",
searchPlaceholder: "Try “return”, “size” or “tracking”",
clearLabel: "Clear search",
topicsLabel: "Filter questions by topic",
allTopics: "All",
countAll: "{count} top order questions",
countOne: "1 answer matches",
countMany: "{count} answers match",
countNone: "No answers match yet",
noMatchTitle: "No answer for “{query}” yet.",
noMatchText: "Send it to the team instead. We'll copy your question into the message box for you.",
noMatchLink: "Ask the team directly",
orderLabel: "Order number",
orderHint: "It's on your order confirmation email.",
orderPlaceholder: "e.g. 10482",
emailLabel: "Email address",
emailPlaceholder: "you@example.com",
messageLabel: "What do you need help with?",
messagePlaceholder: "My order hasn't arrived yet. Can you check it?",
orderRequired: "Enter your order number so we can find your order.",
orderInvalid: "That doesn't look like an order number. Check your confirmation email.",
emailRequired: "Enter the email you ordered with.",
emailInvalid: "Check your email address, like you@example.com.",
messageRequired: "Tell us in a line or two what's going on.",
pendingLabel: "Sending…",
}
const DEFAULT_QUESTIONS: OrderHelpQuestion[] = [
{
question: "Where's my order?",
topic: "Shipping",
keywords: "tracking shipped shipping delivery late package arrive status",
answer: "Your tracking link is in your shipping confirmation email. It updates as soon as the carrier scans your parcel.",
},
{
question: "How do I return an item?",
topic: "Returns",
keywords: "refund send back money label",
answer: "Start your return from the link in your order confirmation email. You'll get a label and step-by-step instructions.",
},
{
question: "Can I exchange for a different size?",
topic: "Sizing",
keywords: "swap bigger smaller fit exchange too small too big",
answer: "Yes. Choose Exchange when you start your return and pick the size you need.",
},
]
const FIELD_ORDER = ["orderNumber", "email", "message"] as const
type FieldName = (typeof FIELD_ORDER)[number]
export function OrderHelp2(props: OrderHelp2Props) {
const {
headline = "Your answer is probably already here.",
lead = "Type what's going on with your order and the answer opens right here. No email, no waiting.",
questions = DEFAULT_QUESTIONS,
defaultOpen = 0,
deskTitle = "Still stuck? Ask the team.",
deskLead = "Send your order number and what's going on. One message is all it takes.",
replyTime = "We reply within 1 business day.",
deskImage,
deskImageAlt = "",
orderPattern = "^#?[A-Z0-9-]{4,20}$",
submitLabel = "Send my question",
submitSublabel = "Goes straight to our order team",
ps = "P.S. Your order number lets us find your order on the very first reply.",
defaultValues,
onSubmit,
onAction,
copy,
state = "default",
className,
} = props
const text = { ...DEFAULT_COPY, ...copy }
const uid = React.useId()
const headingId = `${uid}-heading`
const searchId = `${uid}-search`
const listId = `${uid}-list`
const deskId = `${uid}-desk`
const deskTitleId = `${uid}-desk-title`
const fid = { orderNumber: `${uid}-order`, email: `${uid}-email`, message: `${uid}-message` }
const keyed = questions.map((q, i) => ({ q, key: q.id ?? `q${i}` }))
const [query, setQuery] = React.useState("")
const [topic, setTopic] = React.useState<string | null>(null)
const [openKey, setOpenKey] = React.useState<string | null>(keyed[defaultOpen]?.key ?? null)
const [stuck, setStuck] = React.useState(false)
const [values, setValues] = React.useState<OrderHelpValues>({
orderNumber: defaultValues?.orderNumber ?? "",
email: defaultValues?.email ?? "",
message: defaultValues?.message ?? "",
})
const [touched, setTouched] = React.useState<Record<FieldName, boolean>>({ orderNumber: false, email: false, message: false })
const [submitted, setSubmitted] = React.useState(false)
const [pending, setPending] = React.useState(false)
const searchRef = React.useRef<HTMLInputElement>(null)
const sentinelRef = React.useRef<HTMLDivElement>(null)
const deskRef = React.useRef<HTMLDivElement>(null)
const orderRef = React.useRef<HTMLInputElement>(null)
const emailRef = React.useRef<HTMLInputElement>(null)
const messageRef = React.useRef<HTMLTextAreaElement>(null)
const mounted = React.useRef(true)
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
// Shades the search bar only while it is pinned, so it never cuts a seam into the stage at rest.
React.useEffect(() => {
const node = sentinelRef.current
if (!node || typeof IntersectionObserver === "undefined") return
const io = new IntersectionObserver(([entry]) => setStuck(!entry.isIntersecting && entry.boundingClientRect.top < 0))
io.observe(node)
return () => io.disconnect()
}, [])
const topics = keyed.reduce<string[]>((list, { q }) => (q.topic && !list.includes(q.topic) ? [...list, q.topic] : list), [])
const terms = clean(query).split(" ").filter(Boolean)
const results = keyed.filter(({ q }) => {
if (topic && q.topic !== topic) return false
if (!terms.length) return true
const hay = clean([q.question, typeof q.answer === "string" ? q.answer : "", q.keywords ?? "", q.topic ?? ""].join(" "))
return terms.every((term) => hay.includes(term))
})
// One match left: open it, so the answer is already showing.
React.useEffect(() => {
if (terms.length && results.length === 1) setOpenKey(results[0].key)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [query, topic])
const pattern = React.useMemo(() => {
try {
return new RegExp(orderPattern, "i")
} catch {
return new RegExp("^.{3,}$")
}
}, [orderPattern])
const errors = validate(values, pattern, text)
const forceErrors = state === "error"
const disabled = state === "disabled"
const shown = (name: FieldName) => ((forceErrors || submitted || touched[name]) && errors[name]) || ""
const orderErr = shown("orderNumber")
const emailErr = shown("email")
const messageErr = shown("message")
const forced = state === "hover" ? " is-hover" : state === "active" ? " is-active" : ""
const countText = !terms.length && !topic
? fill(text.countAll, { count: keyed.length })
: results.length === 0
? text.countNone
: results.length === 1
? text.countOne
: fill(text.countMany, { count: results.length })
const setField = (name: FieldName, value: string) => setValues((prev) => ({ ...prev, [name]: value }))
const touch = (name: FieldName) => setTouched((prev) => ({ ...prev, [name]: true }))
const clearSearch = () => {
setQuery("")
searchRef.current?.focus()
}
const askTeam = (event: React.MouseEvent<HTMLAnchorElement>) => {
event.preventDefault()
const asked = query.trim()
if (asked && !values.message.trim()) setField("message", asked)
const still = typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches
deskRef.current?.scrollIntoView({ behavior: still ? "auto" : "smooth", block: "start" })
orderRef.current?.focus({ preventScroll: true })
}
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault()
if (disabled || pending) return
setSubmitted(true)
const found = validate(values, pattern, text)
const first = FIELD_ORDER.find((name) => found[name])
if (first) {
const target = first === "orderNumber" ? orderRef.current : first === "email" ? emailRef.current : messageRef.current
target?.focus()
return
}
const result = onSubmit?.({
orderNumber: values.orderNumber.trim().toUpperCase(),
email: values.email.trim(),
message: values.message.trim(),
})
if (result && typeof (result as Promise<void>).then === "function") {
setPending(true)
try {
await result
} finally {
if (mounted.current) setPending(false)
}
}
}
return (
<section className={`cf-order-help-2${className ? ` ${className}` : ""}`} aria-labelledby={headingId}>
<style>{styles}</style>
<div className="oh2-wrap">
<div className="oh2-stage">
<div className="oh2-stagebg" aria-hidden="true">
<Texture src={leak} tone="band-ink" position="top right" />
</div>
<div className="oh2-stagein">
<h2 id={headingId} className="oh2-headline">
{headline}
</h2>
{lead ? <p className="oh2-lead">{lead}</p> : null}
<div ref={sentinelRef} className="oh2-sentinel" aria-hidden="true" />
<div className={`oh2-finder${stuck ? " is-stuck" : ""}`}>
<div className="oh2-search">
<label htmlFor={searchId} className="oh2-sr">
{text.searchLabel}
</label>
<Search className="oh2-search-icon" size={20} strokeWidth={2.5} aria-hidden="true" />
<input
ref={searchRef}
id={searchId}
className="oh2-search-input"
type="search"
autoComplete="off"
spellCheck={false}
placeholder={text.searchPlaceholder}
value={query}
aria-controls={listId}
onChange={(event) => setQuery(event.target.value)}
onKeyDown={(event) => {
if (event.key === "Escape" && query) {
event.preventDefault()
setQuery("")
}
}}
/>
{query ? (
<button type="button" className="oh2-clear" aria-label={text.clearLabel} onClick={clearSearch}>
<X size={18} strokeWidth={2.5} aria-hidden="true" />
</button>
) : null}
</div>
</div>
{topics.length > 1 ? (
<div className="oh2-topics" role="group" aria-label={text.topicsLabel}>
{[null, ...topics].map((name) => {
const active = topic === name
return (
<button
key={name ?? "all"}
type="button"
className="oh2-chip"
aria-pressed={active}
onClick={() => setTopic(name === null || active ? null : name)}
>
{active ? <Check size={16} strokeWidth={2.5} aria-hidden="true" /> : null}
{name ?? text.allTopics}
</button>
)
})}
</div>
) : null}
<p className="oh2-count" aria-live="polite">
{countText}
</p>
{results.length ? (
<ul id={listId} className="oh2-list">
{results.map(({ q, key }, i) => {
const open = openKey === key
const btnId = `${uid}-${key}-btn`
const panelId = `${uid}-${key}-panel`
return (
<li
key={key}
className="oh2-item"
data-open={open ? "true" : "false"}
style={{ animationDelay: `${Math.min(i * 0.07, 0.28)}s` }}
>
<h3 className="oh2-q">
<button
id={btnId}
type="button"
className="oh2-qbtn"
aria-expanded={open}
aria-controls={panelId}
onClick={() => setOpenKey(open ? null : key)}
>
<span>{q.question}</span>
<span className="oh2-toggle" aria-hidden="true">
<Plus size={20} strokeWidth={2.5} />
</span>
</button>
</h3>
<div id={panelId} role="region" aria-labelledby={btnId} className="oh2-panel">
<div className="oh2-panel-in">
<div className="oh2-answer">
{typeof q.answer === "string" ? <p>{q.answer}</p> : q.answer}
{q.actionLabel && q.actionHref ? (
<a className="oh2-link" href={q.actionHref} onClick={(event) => onAction?.(q, event)}>
{q.actionLabel}
</a>
) : null}
</div>
</div>
</div>
</li>
)
})}
</ul>
) : (
<div id={listId} className="oh2-none">
<span className="oh2-none-icon" aria-hidden="true">
<SearchX size={20} strokeWidth={2.5} />
</span>
<div>
<p className="oh2-none-title">{fill(text.noMatchTitle, { query: query.trim() })}</p>
<p className="oh2-none-text">{text.noMatchText}</p>
<a className="oh2-link" href={`#${deskId}`} onClick={askTeam}>
{text.noMatchLink}
</a>
</div>
</div>
)}
</div>
</div>
<div ref={deskRef} id={deskId} className={`oh2-desk${deskImage ? " has-img" : ""}`}>
{deskImage ? (
<img className="oh2-deskimg" src={deskImage} alt={deskImageAlt} width={440} height={440} loading="lazy" decoding="async" />
) : null}
<form className="oh2-card" noValidate onSubmit={handleSubmit} aria-labelledby={deskTitleId}>
<h3 id={deskTitleId} className="oh2-desk-title">
{deskTitle}
</h3>
{deskLead ? <p className="oh2-desk-lead">{deskLead}</p> : null}
{replyTime ? (
<p className="oh2-reply">
<Clock className="oh2-inl" size={16} strokeWidth={2.5} aria-hidden="true" />
{replyTime}
</p>
) : null}
<fieldset className="oh2-fields" disabled={disabled}>
<div className="oh2-field">
<label className="oh2-label" htmlFor={fid.orderNumber}>
{text.orderLabel}
</label>
<input
ref={orderRef}
id={fid.orderNumber}
className="oh2-input"
name="orderNumber"
type="text"
autoComplete="off"
autoCapitalize="characters"
spellCheck={false}
maxLength={24}
placeholder={text.orderPlaceholder}
value={values.orderNumber}
onChange={(event) => setField("orderNumber", event.target.value.toUpperCase())}
onBlur={() => touch("orderNumber")}
aria-invalid={orderErr ? true : undefined}
aria-describedby={`${orderErr ? `${fid.orderNumber}-err ` : ""}${fid.orderNumber}-hint`}
/>
{orderErr ? (
<p id={`${fid.orderNumber}-err`} className="oh2-error">
<AlertCircle className="oh2-inl" size={16} strokeWidth={2.5} aria-hidden="true" />
{orderErr}
</p>
) : null}
<p id={`${fid.orderNumber}-hint`} className="oh2-hint">
{text.orderHint}
</p>
</div>
<div className="oh2-field">
<label className="oh2-label" htmlFor={fid.email}>
{text.emailLabel}
</label>
<input
ref={emailRef}
id={fid.email}
className="oh2-input"
name="email"
type="email"
autoComplete="email"
inputMode="email"
placeholder={text.emailPlaceholder}
value={values.email}
onChange={(event) => setField("email", event.target.value)}
onBlur={() => touch("email")}
aria-invalid={emailErr ? true : undefined}
aria-describedby={emailErr ? `${fid.email}-err` : undefined}
/>
{emailErr ? (
<p id={`${fid.email}-err`} className="oh2-error">
<AlertCircle className="oh2-inl" size={16} strokeWidth={2.5} aria-hidden="true" />
{emailErr}
</p>
) : null}
</div>
<div className="oh2-field">
<label className="oh2-label" htmlFor={fid.message}>
{text.messageLabel}
</label>
<textarea
ref={messageRef}
id={fid.message}
className="oh2-input"
name="message"
rows={4}
placeholder={text.messagePlaceholder}
value={values.message}
onChange={(event) => setField("message", event.target.value)}
onBlur={() => touch("message")}
aria-invalid={messageErr ? true : undefined}
aria-describedby={messageErr ? `${fid.message}-err` : undefined}
/>
{messageErr ? (
<p id={`${fid.message}-err`} className="oh2-error">
<AlertCircle className="oh2-inl" size={16} strokeWidth={2.5} aria-hidden="true" />
{messageErr}
</p>
) : null}
</div>
</fieldset>
<button type="submit" className={`oh2-submit${forced}`} disabled={disabled} aria-busy={pending || undefined}>
<span className="oh2-submit-main">
{pending ? (
<>
<Loader2 className="oh2-spin" size={20} strokeWidth={2.5} aria-hidden="true" />
{text.pendingLabel}
</>
) : (
submitLabel
)}
</span>
{submitSublabel ? <span className="oh2-submit-sub">{submitSublabel}</span> : null}
</button>
{ps ? <p className="oh2-ps">{renderPs(ps)}</p> : null}
</form>
</div>
</div>
</section>
)
}
export default OrderHelp2
function clean(value: string) {
return value.toLowerCase().replace(/['’]/g, "").split("?").join(" ").trim()
}
function fill(template: string, vars: Record<string, string | number>) {
return Object.entries(vars).reduce((out, [key, value]) => out.split(`{${key}}`).join(String(value)), template)
}
function looksLikeEmail(value: string) {
const at = value.indexOf("@")
const dot = value.lastIndexOf(".")
return at > 0 && dot > at + 1 && dot < value.length - 2 && !value.includes(" ") && value.indexOf("@", at + 1) === -1
}
function validate(values: OrderHelpValues, pattern: RegExp, text: OrderHelp2Copy) {
const errors: Partial<Record<FieldName, string>> = {}
const order = values.orderNumber.trim()
if (!order) errors.orderNumber = text.orderRequired
else if (!pattern.test(order)) errors.orderNumber = text.orderInvalid
const email = values.email.trim()
if (!email) errors.email = text.emailRequired
else if (!looksLikeEmail(email)) errors.email = text.emailInvalid
if (values.message.trim().length < 2) errors.message = text.messageRequired
return errors
}
function renderPs(ps: string) {
if (!ps.startsWith("P.S.")) return ps
return (
<>
<strong>P.S.</strong>
{ps.slice(4)}
</>
)
}
const CARD_SHADOW = "var(--card-shadow,var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / .22),0 4px 10px -2px oklch(0.22 0.03 260 / .2)))"
const CARD_BORDER = "1px solid var(--card-border,oklch(from var(--ink) l c h / .12))"
const FIELD_BORDER = "1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent))"
const styles = `
.cf-order-help-2{--oh2-g:clamp(16px,5vw,48px);--oh2-gap:clamp(32px,6vw,88px);--oh2-pt:clamp(56px,8vw,112px);--oh2-pb:clamp(64px,8.5vw,120px);--oh2-w:min(1120px,calc(100cqw - 2 * var(--oh2-g)));--oh2-ring:var(--field-focus,var(--accent));--oh2-shadow:var(--shadow,oklch(0.22 0.03 260));container-type:inline-size;position:relative;overflow-x:clip;margin:0;padding:var(--oh2-pt) 0 var(--oh2-pb);background:var(--surface);color:var(--ink);font-family:var(--font-body);font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5}
.cf-order-help-2 *,.cf-order-help-2 *::before,.cf-order-help-2 *::after{box-sizing:border-box}
.cf-order-help-2 .oh2-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-order-help-2 .oh2-wrap{position:relative;width:var(--oh2-w);margin-inline:auto;display:grid;grid-template-columns:minmax(0,1fr);row-gap:32px}
.cf-order-help-2 .oh2-stage{position:relative;isolation:isolate;min-width:0;padding-bottom:72px;color:var(--band-ink);background-color:var(--band);background-clip:content-box}
.cf-order-help-2 .oh2-stagebg{position:absolute;z-index:0;top:calc(-1 * var(--oh2-pt));bottom:0;left:calc((var(--oh2-w) - 100cqw) / 2);right:calc((var(--oh2-w) - 100cqw) / 2);overflow:hidden;background:var(--band);clip-path:polygon(0 0,100% 0,100% calc(100% - 40px),0 100%);pointer-events:none}
.cf-order-help-2 .oh2-stagein{position:relative;z-index:1}
.cf-order-help-2 .oh2-headline{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;color:var(--band-ink);text-wrap:balance}
.cf-order-help-2 .oh2-lead{margin:16px 0 0;max-width:60ch;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--band-ink);text-wrap:pretty}
.cf-order-help-2 .oh2-sentinel{height:1px;margin:15px 0 -1px}
.cf-order-help-2 .oh2-finder{position:sticky;top:0;z-index:3;margin:0 -6px;padding:12px 6px;transition:background-color .16s ease}
.cf-order-help-2 .oh2-finder.is-stuck{background:var(--band)}
.cf-order-help-2 .oh2-finder::after{content:"";position:absolute;left:0;right:0;top:100%;height:16px;background:linear-gradient(var(--band),oklch(from var(--band) l c h / 0));opacity:0;transition:opacity .16s ease;pointer-events:none}
.cf-order-help-2 .oh2-finder.is-stuck::after{opacity:1}
.cf-order-help-2 .oh2-search{position:relative}
.cf-order-help-2 .oh2-search-icon{position:absolute;left:18px;top:50%;transform:translateY(-50%);color:color-mix(in oklch,var(--field-ink) 65%,var(--field));pointer-events:none}
.cf-order-help-2 .oh2-search-input{display:block;width:100%;height:60px;margin:0;padding:0 56px 0 50px;border:${FIELD_BORDER};border-radius:var(--field-radius,var(--radius,12px));background:var(--field);color:var(--field-ink);font:500 17px/1.2 var(--font-body);box-shadow:var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / .22),0 4px 10px -2px oklch(0.22 0.03 260 / .2));appearance:none;-webkit-appearance:none;transition:border-color .16s ease}
.cf-order-help-2 .oh2-search-input::-webkit-search-cancel-button,.cf-order-help-2 .oh2-search-input::-webkit-search-decoration{-webkit-appearance:none;appearance:none}
.cf-order-help-2 .oh2-search-input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
.cf-order-help-2 .oh2-search-input:focus{outline:3px solid oklch(from var(--band-ink) l c h / .7);outline-offset:2px;border-color:var(--oh2-ring)}
.cf-order-help-2 .oh2-clear{position:absolute;right:8px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:44px;height:44px;margin:0;padding:0;border:0;border-radius:999px;background:transparent;color:color-mix(in oklch,var(--field-ink) 72%,var(--field));cursor:pointer;transition:background-color .16s ease,color .16s ease}
.cf-order-help-2 .oh2-clear:hover{background:color-mix(in oklch,var(--field-ink) 8%,var(--field));color:var(--field-ink)}
.cf-order-help-2 .oh2-clear:focus-visible{outline:3px solid oklch(from var(--oh2-ring) l c h / .55);outline-offset:-3px}
.cf-order-help-2 .oh2-topics{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.cf-order-help-2 .oh2-chip{display:inline-flex;align-items:center;gap:6px;min-height:36px;margin:0;padding:4px 14px;border:1px solid oklch(from var(--band-ink) l c h / .26);border-radius:999px;background:oklch(from var(--band-ink) l c h / .12);color:var(--band-ink);font:800 14px/1.2 var(--font-body);cursor:pointer;transition:background-color .16s ease,border-color .16s ease,color .16s ease,transform .16s ease}
.cf-order-help-2 .oh2-chip:hover{background:oklch(from var(--band-ink) l c h / .2)}
.cf-order-help-2 .oh2-chip:active{transform:translateY(1px)}
.cf-order-help-2 .oh2-chip[aria-pressed="true"]{background:var(--card);border-color:var(--card);color:var(--ink)}
.cf-order-help-2 .oh2-chip:focus-visible{outline:3px solid oklch(from var(--band-ink) l c h / .7);outline-offset:2px}
.cf-order-help-2 .oh2-count{margin:16px 0 0;font-size:15px;font-weight:600;line-height:1.4;color:var(--band-ink)}
.cf-order-help-2 .oh2-list{display:grid;gap:12px;margin:12px 0 0;padding:0;list-style:none}
.cf-order-help-2 .oh2-item{margin:0;background:var(--card);color:var(--ink);border:${CARD_BORDER};border-radius:var(--card-radius,var(--radius,14px));box-shadow:${CARD_SHADOW};transition:border-color .16s ease,box-shadow .16s ease;animation:oh2-in .45s cubic-bezier(.2,.7,.2,1) both}
.cf-order-help-2 .oh2-item[data-open="true"]{border-color:oklch(from var(--accent) l c h / .55);box-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))}
.cf-order-help-2 .oh2-q{margin:0;font:inherit}
.cf-order-help-2 .oh2-qbtn{display:flex;align-items:center;justify-content:space-between;gap:16px;width:100%;margin:0;padding:clamp(16px,2.2vw,20px) clamp(16px,2.6vw,24px) clamp(16px,2.2vw,20px) clamp(18px,2.8vw,28px);border:0;border-radius:var(--card-radius,var(--radius,14px));background:transparent;color:var(--ink);font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.25;letter-spacing:-0.01em;text-align:left;text-wrap:pretty;cursor:pointer}
.cf-order-help-2 .oh2-qbtn:focus-visible{outline:3px solid oklch(from var(--oh2-ring) l c h / .6);outline-offset:-4px}
.cf-order-help-2 .oh2-toggle{flex:none;display:grid;place-items:center;width:40px;height:40px;border-radius:999px;background:color-mix(in oklch,var(--ink) 6%,var(--card));color:var(--ink);transition:background-color .16s ease,color .16s ease}
.cf-order-help-2 .oh2-toggle svg{transition:transform .25s cubic-bezier(.2,.7,.2,1)}
.cf-order-help-2 .oh2-qbtn:hover .oh2-toggle{background:color-mix(in oklch,var(--ink) 11%,var(--card))}
.cf-order-help-2 .oh2-item[data-open="true"] .oh2-toggle{background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card))}
.cf-order-help-2 .oh2-item[data-open="true"] .oh2-toggle svg{transform:rotate(45deg)}
.cf-order-help-2 .oh2-panel{display:grid;grid-template-rows:0fr;visibility:hidden;transition:grid-template-rows .3s cubic-bezier(.2,.7,.2,1),visibility 0s linear .3s}
.cf-order-help-2 .oh2-item[data-open="true"] .oh2-panel{grid-template-rows:1fr;visibility:visible;transition:grid-template-rows .3s cubic-bezier(.2,.7,.2,1),visibility 0s}
.cf-order-help-2 .oh2-panel-in{min-height:0;overflow:hidden}
.cf-order-help-2 .oh2-answer{max-width:68ch;padding:0 clamp(18px,2.8vw,28px) clamp(18px,2.6vw,24px);color:var(--ink);text-wrap:pretty}
.cf-order-help-2 .oh2-answer p{margin:0}
.cf-order-help-2 .oh2-answer p + p{margin-top:12px}
.cf-order-help-2 .oh2-link{display:inline-block;margin-top:12px;border-radius:4px;font-weight:700;color:var(--link,var(--accent));text-decoration:underline;text-decoration-color:oklch(from var(--link,var(--accent)) l c h / .45);text-decoration-thickness:2px;text-underline-offset:.18em;transition:color .16s ease}
.cf-order-help-2 .oh2-link:hover{color:oklch(from var(--link,var(--accent)) calc(l - 0.08) c h);text-decoration-color:currentColor}
.cf-order-help-2 .oh2-link:focus-visible{outline:3px solid oklch(from var(--oh2-ring) l c h / .55);outline-offset:3px}
.cf-order-help-2 .oh2-none{display:grid;grid-template-columns:auto minmax(0,1fr);gap:16px;align-items:start;margin-top:12px;padding:clamp(20px,3vw,28px);background:var(--card);color:var(--ink);border:${CARD_BORDER};border-radius:var(--card-radius,var(--radius,14px));box-shadow:${CARD_SHADOW};animation:oh2-in .45s cubic-bezier(.2,.7,.2,1) both}
.cf-order-help-2 .oh2-none-icon{display:grid;place-items:center;width:40px;height:40px;border-radius:999px;background:color-mix(in oklch,var(--ink) 6%,var(--card));color:var(--ink)}
.cf-order-help-2 .oh2-none-title{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.25;overflow-wrap:anywhere;text-wrap:balance}
.cf-order-help-2 .oh2-none-text{margin:8px 0 0;color:var(--muted);text-wrap:pretty}
.cf-order-help-2 .oh2-desk{position:relative;z-index:2;min-width:0}
.cf-order-help-2 .oh2-deskimg{position:relative;z-index:2;display:block;width:clamp(150px,18cqw,220px);height:auto;aspect-ratio:1 / 1;object-fit:contain;margin:-56px 4px -24px auto;filter:drop-shadow(0 2px 3px oklch(from var(--oh2-shadow) l c h / .28)) drop-shadow(0 12px 16px oklch(from var(--oh2-shadow) l c h / .22))}
.cf-order-help-2 .oh2-card{--oh2-cp:clamp(20px,3vw,32px);position:relative;z-index:1;margin:0;padding:var(--oh2-cp);background:var(--card);color:var(--ink);border:${CARD_BORDER};border-radius:var(--card-radius,var(--radius,14px));box-shadow:${CARD_SHADOW}}
.cf-order-help-2 .oh2-desk.has-img .oh2-card{padding-top:calc(var(--oh2-cp) + 16px)}
.cf-order-help-2 .oh2-desk-title{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:-0.01em;text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;color:var(--ink);text-wrap:balance}
.cf-order-help-2 .oh2-desk-lead{margin:12px 0 0;color:var(--muted);text-wrap:pretty}
.cf-order-help-2 .oh2-reply{margin:16px 0 0;padding:12px 14px;border-radius:10px;background:color-mix(in oklch,var(--ink) 4%,var(--card));font-size:15px;font-weight:600;line-height:1.4;color:var(--ink);text-wrap:pretty}
.cf-order-help-2 .oh2-inl{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em}
.cf-order-help-2 .oh2-fields{display:grid;gap:18px;min-width:0;margin:24px 0 0;padding:0;border:0}
.cf-order-help-2 .oh2-field{display:grid;gap:8px;min-width:0}
.cf-order-help-2 .oh2-label{font-size:16px;font-weight:700;line-height:1.3;color:var(--label-ink,var(--ink))}
.cf-order-help-2 .oh2-input{display:block;width:100%;height:56px;margin:0;padding:0 16px;border:${FIELD_BORDER};border-radius:var(--field-radius,var(--radius,12px));background:var(--field);color:var(--field-ink);font:400 17px/1.3 var(--font-body);appearance:none;-webkit-appearance:none;transition:border-color .16s ease,box-shadow .16s ease}
.cf-order-help-2 textarea.oh2-input{height:auto;min-height:120px;padding:14px 16px;line-height:1.45;resize:vertical}
.cf-order-help-2 .oh2-input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
.cf-order-help-2 .oh2-input:hover:not(:disabled){border-color:color-mix(in oklch,var(--ink) 38%,transparent)}
.cf-order-help-2 .oh2-input:focus{outline:none;border-color:var(--oh2-ring);box-shadow:0 0 0 3px oklch(from var(--oh2-ring) l c h / .35)}
.cf-order-help-2 .oh2-input[aria-invalid="true"]{border-color:var(--danger);box-shadow:inset 0 0 0 1px var(--danger)}
.cf-order-help-2 .oh2-input[aria-invalid="true"]:focus{box-shadow:inset 0 0 0 1px var(--danger),0 0 0 3px oklch(from var(--danger) l c h / .3)}
.cf-order-help-2 .oh2-input:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--field-ink) 5%,var(--field))}
.cf-order-help-2 .oh2-hint{margin:0;font-size:15px;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-order-help-2 .oh2-error{margin:0;font-size:15px;font-weight:600;line-height:1.4;color:var(--danger);text-wrap:pretty}
.cf-order-help-2 .oh2-submit{--oh2-bg:var(--button-bg,var(--cta));--oh2-bg2:var(--button-bg-2,var(--cta-2));display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;width:100%;min-height:68px;margin:24px 0 0;padding:10px 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--oh2-bg) calc(l + 0.04) c h),oklch(from var(--oh2-bg2) calc(l - 0.02) c h));color:var(--button-ink,var(--cta-ink));font-family:var(--button-font,var(--font-display));text-align:center;text-shadow:var(--button-text-shadow,none);box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--oh2-bg) calc(l + 0.14) c h / .7),inset 0 -3px 0 oklch(from var(--oh2-bg) calc(l - 0.16) c h),0 1px 2px oklch(from var(--oh2-shadow) l c h / .3),0 8px 16px -6px oklch(from var(--oh2-shadow) l c h / .45));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-order-help-2 .oh2-submit-main{display:inline-flex;align-items:center;justify-content:center;gap:8px;font-size:clamp(1.125rem,1.55vw,1.375rem);font-weight:var(--button-weight,800);line-height:1.15;text-transform:var(--button-case,none)}
.cf-order-help-2 .oh2-submit-sub{font-family:var(--font-body);font-size:15px;font-weight:500;line-height:1.3;text-wrap:pretty}
.cf-order-help-2 .oh2-submit:hover:not(:disabled),.cf-order-help-2 .oh2-submit.is-hover{background:linear-gradient(oklch(from var(--oh2-bg) calc(l - 0.01) c h),oklch(from var(--oh2-bg2) calc(l - 0.07) c h));transform:translateY(-1px);box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--oh2-bg) calc(l + 0.1) c h / .6),inset 0 -3px 0 oklch(from var(--oh2-bg) calc(l - 0.18) c h),0 1px 2px oklch(from var(--oh2-shadow) l c h / .32),0 12px 20px -6px oklch(from var(--oh2-shadow) l c h / .5))}
.cf-order-help-2 .oh2-submit:active:not(:disabled),.cf-order-help-2 .oh2-submit.is-active{transform:translateY(1px);background:linear-gradient(oklch(from var(--oh2-bg) calc(l - 0.04) c h),oklch(from var(--oh2-bg2) calc(l - 0.08) c h));box-shadow:inset 0 2px 4px oklch(from var(--oh2-bg) calc(l - 0.22) c h / .55),inset 0 -2px 0 oklch(from var(--oh2-bg) calc(l - 0.16) c h),0 1px 2px oklch(from var(--oh2-shadow) l c h / .3)}
.cf-order-help-2 .oh2-submit:focus-visible{outline:3px solid oklch(from var(--button-bg,var(--cta)) l c h / .55);outline-offset:3px}
.cf-order-help-2 .oh2-submit:disabled{background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));text-shadow:none;box-shadow:var(--button-2-shadow,var(--shadow-sm));cursor:not-allowed;transform:none}
.cf-order-help-2 .oh2-submit[aria-busy="true"]{cursor:progress}
.cf-order-help-2 .oh2-spin{animation:oh2-spin .8s linear infinite}
.cf-order-help-2 .oh2-ps{margin:16px 0 0;font-size:15px;line-height:1.45;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-order-help-2 .oh2-ps strong{font-weight:800;color:var(--ink)}
@keyframes oh2-in{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes oh2-spin{to{transform:rotate(360deg)}}
@container (min-width: 900px){
.cf-order-help-2 .oh2-wrap{grid-template-columns:minmax(0,7fr) minmax(0,5fr);column-gap:var(--oh2-gap);align-items:start}
.cf-order-help-2 .oh2-stage{align-self:stretch;padding-bottom:0}
.cf-order-help-2 .oh2-stagebg{bottom:calc(-1 * var(--oh2-pb));right:calc(-0.9 * var(--oh2-gap));clip-path:polygon(0 0,100% 0,calc(100% - 0.8 * var(--oh2-gap)) 100%,0 100%)}
.cf-order-help-2 .oh2-deskimg{margin-top:0}
}
@media (prefers-reduced-motion: reduce){
.cf-order-help-2 *,.cf-order-help-2 *::before,.cf-order-help-2 *::after{animation:none!important;transition:none!important}
}
`
pieces/checkout/order-help-2/specimen.tsx 92 lines
import __studioImage5940235b from "../assets/de9a7bdf3e8a6e35.webp";
// Specimen: Tidewater Swim's answer-first order help desk, with sample swimwear questions and the kit's guarantee.
import * as React from "react"
import { OrderHelp2, type OrderHelp2Props, type OrderHelpQuestion } from "../order-help-2"
import defaults from "../../studio-defaults.json"
import { slot } from "../../slots"
export const states = ["default", "hover", "active", "disabled", "error"]
const guarantee = defaults.sample.guarantee
const QUESTIONS: OrderHelpQuestion[] = [
{
id: "where",
question: "Where's my order?",
topic: "Shipping",
keywords: "tracking shipped shipping delivery late lost package arrive status",
answer: "Your tracking link is in the shipping email we send the moment your order leaves our warehouse. Most orders arrive in 3 to 5 business days. If tracking hasn't moved in 3 days, send us your order number below.",
actionLabel: "Track my order",
actionHref: "#track",
},
{
id: "return",
question: "How do I return a swimsuit?",
topic: "Returns",
keywords: "refund send back money label",
answer: "Open the return link in your order confirmation email, print the prepaid label and drop the parcel at any post office. Suits need their hygiene liner and tags attached. Your refund is sent the day your return reaches us.",
actionLabel: "Start a return",
actionHref: "#returns",
},
{
id: "swap",
question: "Can I swap my suit for a different size?",
topic: "Sizing",
keywords: "exchange swap bigger smaller fit too small too big",
answer: "Yes. Choose Exchange when you start your return and pick your new size. We ship the new suit as soon as the carrier scans your original, so you're not waiting for it to reach us.",
actionLabel: "Start an exchange",
actionHref: "#exchange",
},
{
id: "between",
question: "I'm between two sizes. Which should I pick?",
topic: "Sizing",
keywords: "size chart fit guide measurements between torso bikini one-piece",
answer: "Size up in one-pieces if you have a longer torso. For bikinis with tie sides, stay true to size. Every product page has a fit guide with measurements in inches and centimetres.",
},
{
id: "change",
question: "Can I change or cancel my order?",
topic: "Orders",
keywords: "cancel change address edit wrong mistake",
answer: "Within one hour of checkout, yes. Send your order number and the change in the form and we'll catch it before it's packed.",
},
{
id: "covered",
question: "What if my suit doesn't work out?",
topic: "Returns",
keywords: "guarantee refund unhappy money back",
answer: `You're covered by our ${guarantee}. If the suit isn't right, send it back within 30 days and we'll refund you in full.`,
},
]
export default function OrderHelp2Specimen({ state = "default" }: { state?: OrderHelp2Props["state"] }) {
return (
<OrderHelp2
headline="Your answer is probably already here."
lead="Type what's going on with your order and the answer opens right here. Returns, size swaps and tracking, sorted before you ever wait on an email."
questions={QUESTIONS}
deskTitle="Still stuck? Ask the swim team."
deskLead="Send your order number and a line about what's wrong. One message is all it takes."
replyTime="Our order team replies within 1 business day, Monday to Saturday."
deskImage={slot("product", __studioImage5940235b)}
deskImageAlt="A folded teal swimsuit on a white mailer box"
orderPattern="^#?TW-?[0-9]{5}$"
copy={{
orderHint: "Starts with TW. It's on your order confirmation email.",
orderPlaceholder: "TW-20418",
orderInvalid: "That doesn't look like a Tidewater order number. It starts with TW, like TW-20418.",
messagePlaceholder: "My suit runs small. Can I swap it for a medium?",
}}
defaultValues={
state === "error"
? { orderNumber: "20418", email: "maya@example.com", message: "My suit runs small. Can I swap it for a medium?" }
: undefined
}
submitLabel="Send my question"
submitSublabel="Goes straight to our order team"
ps={`P.S. Ordered the wrong size? Every suit is covered by our ${guarantee}, so trying it on costs you nothing.`}
state={state}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalOrderHelp2 |
string |
|
lead OptionalOrderHelp2 |
string |
|
questions OptionalOrderHelp2 |
OrderHelpQuestion[] |
|
defaultOpen OptionalOrderHelp2 |
number |
|
deskTitle OptionalOrderHelp2 |
string |
|
deskLead OptionalOrderHelp2 |
string |
|
replyTime OptionalOrderHelp2 |
string |
|
deskImage OptionalOrderHelp2 |
string |
|
deskImageAlt OptionalOrderHelp2 |
string |
|
orderPattern OptionalOrderHelp2 |
string |
|
submitLabel OptionalOrderHelp2 |
string |
|
submitSublabel OptionalOrderHelp2 |
string |
|
ps OptionalOrderHelp2 |
string |
|
defaultValues OptionalOrderHelp2 |
Partial<OrderHelpValues> |
|
onSubmit OptionalOrderHelp2 |
(values: OrderHelpValues) => void | Promise<void> |
|
onAction OptionalOrderHelp2 |
(question: OrderHelpQuestion, event: React.MouseEvent<HTMLAnchorElement>) => void |
|
copy OptionalOrderHelp2 |
Partial<OrderHelp2Copy> |
|
state OptionalOrderHelp2 |
"default" | "hover" | "active" | "disabled" | "error" |
|
className OptionalOrderHelp2 |
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-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--field-border--field-focus--field-ink--field-radius- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
product- The main product shot or cover (ebook, kit, bottle).
-
986367d82c360c9a.webp
image/webp · 102 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
de9a7bdf3e8a6e35.webp
image/webp · 48.2 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB