Discussion Thread 1
Discussion thread under a lesson video: a pinned host prompt asks for the helpful mark and one written
Use it in a prompt
Use content/discussion-thread 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/content/discussion-thread.tsx. - Import it and pass your copy and images (Props tab):
import { DiscussionThread } from "@/components/funneldna/content/discussion-thread"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/discussion-thread/component.tsx 475 lines
// layout: classic-centred-stack
// Discussion thread under a lesson video: a pinned host prompt asks for the helpful mark and one written
// takeaway, so viewers commit to the idea in public and keep moving through the series.
import React, { useId, useRef, useState } from "react";
import { AlertCircle, Loader2, Pin, Reply, ThumbsUp } from "lucide-react";
import { FX_HOST, Spot, Texture } from "../fx/fx";
import linen from "../fx/textures/linen";
import community from "../fx/spots/community";
export type DiscussionComment = {
/** Stable id; falls back to the list position */
id?: string;
name: string;
body: React.ReactNode;
/** Time-ago or context line, e.g. "12 min ago" */
meta?: string;
/** Avatar image src; initials are drawn when absent */
avatar?: string;
/** The host's own comment: host badge, presenter photo as avatar */
isHost?: boolean;
/** Supplied helpful marks on this comment (proof: only pass real counts) */
helpfulCount?: number;
replies?: DiscussionComment[];
};
export type DiscussionThreadProps = {
headline?: string;
/** Phrase inside the headline that gets the marker stroke */
highlight?: string;
/** One-sentence punch lines under the headline; the last one is set bold */
leadLines?: string[];
hostName?: string;
/** presenter slot: the host's portrait for the pin and the host's comments */
presenterImage?: string;
/** Template with {name} */
pinnedLabel?: string;
helpfulQuestion?: string;
helpfulLabel?: string;
helpfulPressedLabel?: string;
/** Initial pressed state of the lesson's helpful toggle */
helpful?: boolean;
onHelpful?: (pressed: boolean) => void;
fieldLabel?: string;
placeholder?: string;
minLength?: number;
maxLength?: number;
/** Template with {count} and {max} */
counterLabel?: string;
postLabel?: string;
postingLabel?: string;
/** Quiet line under the button that jumps down to the thread */
secondaryLine?: string;
errorMessage?: string;
/** Supplied comments; empty shows the invite-the-first-comment state */
comments?: DiscussionComment[];
/** Total comments on the lesson; defaults to the comments given */
totalCount?: number;
/** Templates with {count} */
countLabel?: string;
countLabelOne?: string;
sortLabel?: string;
hostBadge?: string;
commentHelpfulLabel?: string;
replyLabel?: string;
/** Accessible reply label, template with {name} */
replyAriaLabel?: string;
hasMore?: boolean;
loadingMore?: boolean;
moreLabel?: string;
loadingLabel?: string;
emptyTitle?: string;
emptyBody?: string;
/** Shows the posting state on the button while the builder saves */
submitting?: boolean;
onSubmit?: (values: { comment: string }) => void;
onReply?: (comment: DiscussionComment) => void;
onCommentHelpful?: (comment: DiscussionComment, pressed: boolean) => void;
onLoadMore?: () => void;
state?: "default" | "hover" | "active" | "disabled" | "error";
className?: string;
};
export function DiscussionThread(props: DiscussionThreadProps) {
const {
headline = "Mark this lesson helpful, then post your best takeaway below.",
highlight = "best takeaway",
leadLines = ["Finished the lesson?", "Write down the one idea you'll put to work first.", "Post it below.", "Done."],
hostName = "your host",
presenterImage,
pinnedLabel = "Pinned by {name}",
helpfulQuestion = "Did this lesson help you?",
helpfulLabel = "Helpful",
helpfulPressedLabel = "Marked helpful",
helpful = false,
onHelpful,
fieldLabel = "Your best takeaway",
placeholder = "The one idea I'm putting to work first is…",
minLength = 2,
maxLength = 500,
counterLabel = "{count} / {max}",
postLabel = "Post my takeaway",
postingLabel = "Posting…",
secondaryLine = "or read what others are putting to work",
errorMessage = "Write a takeaway before you post. One line is plenty.",
comments = [],
totalCount,
countLabel = "{count} takeaways",
countLabelOne = "{count} takeaway",
sortLabel = "Newest first",
hostBadge = "Host",
commentHelpfulLabel = "Helpful",
replyLabel = "Reply",
replyAriaLabel = "Reply to {name}",
hasMore = false,
loadingMore = false,
moreLabel = "Show more takeaways",
loadingLabel = "Loading takeaways…",
emptyTitle = "Be the first to post a takeaway",
emptyBody = "Your note sets the tone for everyone who watches after you.",
submitting = false,
onSubmit,
onReply,
onCommentHelpful,
onLoadMore,
state = "default",
className,
} = props;
const uid = "cfdt" + useId().replace(/[^a-zA-Z0-9_-]/g, "");
const fieldRef = useRef<HTMLTextAreaElement>(null);
const [value, setValue] = useState("");
const [invalid, setInvalid] = useState(false);
const [helpfulOn, setHelpfulOn] = useState(helpful);
const [liked, setLiked] = useState<Record<string, boolean>>({});
const disabled = state === "disabled";
const showError = state === "error" || invalid;
const total = totalCount ?? countAll(comments);
const countText = (total === 1 ? countLabelOne : countLabel).replace("{count}", String(total));
const counter = counterLabel.replace("{count}", String(value.length)).replace("{max}", String(maxLength));
const [pinBefore, pinAfter = ""] = pinnedLabel.split("{name}");
const toggleHelpful = () => {
const next = !helpfulOn;
setHelpfulOn(next);
onHelpful?.(next);
};
const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
const next = e.target.value;
setValue(next);
if (invalid && next.trim().length >= minLength) setInvalid(false);
};
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (disabled || submitting) return;
const comment = value.trim();
if (comment.length < minLength) {
setInvalid(true);
fieldRef.current?.focus();
return;
}
setInvalid(false);
onSubmit?.({ comment });
};
const toggleLike = (key: string, c: DiscussionComment) => {
const next = !liked[key];
setLiked((prev) => ({ ...prev, [key]: next }));
onCommentHelpful?.(c, next);
};
const renderComment = (c: DiscussionComment, index: number, path: string, depth: number): React.ReactNode => {
const key = c.id ?? `${path}${index}`;
const pressed = Boolean(liked[key]);
const count = (c.helpfulCount ?? 0) + (pressed ? 1 : 0);
const avatar = c.avatar ?? (c.isHost ? presenterImage : undefined);
return (
<li
key={key}
className={`cf-dt-item${depth > 0 ? " is-reply" : ""}`}
style={depth === 0 ? { animationDelay: `${Math.min(index * 0.07, 0.28)}s` } : undefined}
>
{avatar ? (
<img className="cf-dt-av" src={avatar} alt="" width={44} height={44} loading="lazy" decoding="async" />
) : (
<span className={`cf-dt-av cf-dt-init${c.isHost ? " is-host" : ""}`} aria-hidden="true">
{initials(c.name)}
</span>
)}
<div className="cf-dt-body">
<p className="cf-dt-head">
<strong className="cf-dt-name">{c.name}</strong>
{c.isHost && <span className="cf-dt-host">{hostBadge}</span>}
{c.meta && <span className="cf-dt-meta">{c.meta}</span>}
</p>
<div className="cf-dt-text">{c.body}</div>
<div className="cf-dt-actions">
<button type="button" className="cf-dt-act" aria-pressed={pressed} onClick={() => toggleLike(key, c)}>
<ThumbsUp size={16} strokeWidth={2.5} aria-hidden="true" />
<span>{commentHelpfulLabel}</span>
{count > 0 && <span className="cf-dt-num">{count}</span>}
</button>
<button
type="button"
className="cf-dt-act"
aria-label={replyAriaLabel.replace("{name}", c.name)}
onClick={() => onReply?.(c)}
>
<Reply size={16} strokeWidth={2.5} aria-hidden="true" />
<span>{replyLabel}</span>
</button>
</div>
{c.replies && c.replies.length > 0 && (
<ol className="cf-dt-replies" role="list">
{c.replies.map((r, i) => renderComment(r, i, `${key}-`, depth + 1))}
</ol>
)}
</div>
</li>
);
};
const postClass =
"cf-dt-post" +
(state === "hover" ? " is-hover" : "") +
(state === "active" ? " is-active" : "") +
(submitting ? " is-busy" : "");
return (
<section
className={`cf-discussion-thread${className ? ` ${className}` : ""}`}
style={FX_HOST}
aria-labelledby={`${uid}-title`}
>
<style>{CSS}</style>
<Texture src={linen} tone="ink" />
<div className="cf-dt-inner">
<h2 id={`${uid}-title`} className="cf-dt-title">
{markPhrase(headline, highlight)}
</h2>
{leadLines.length > 0 && (
<div className="cf-dt-lead">
{leadLines.map((line, i) => (
<p key={i}>{line}</p>
))}
</div>
)}
{hostName && (
<p className="cf-dt-pin">
{presenterImage ? (
<img className="cf-dt-pin-img" src={presenterImage} alt="" width={36} height={36} />
) : (
<span className="cf-dt-pin-img cf-dt-pin-icon" aria-hidden="true">
<Pin size={18} strokeWidth={2.5} />
</span>
)}
<span>
{presenterImage && <Pin className="cf-dt-inl" size={16} strokeWidth={2.5} aria-hidden="true" />}
{pinBefore}
<strong>{hostName}</strong>
{pinAfter}
</span>
</p>
)}
<form className="cf-dt-card" onSubmit={handleSubmit} noValidate>
<div className="cf-dt-cardhead">
<p className="cf-dt-q">{helpfulQuestion}</p>
<button type="button" className="cf-dt-help" aria-pressed={helpfulOn} disabled={disabled} onClick={toggleHelpful}>
<ThumbsUp size={18} strokeWidth={2.5} aria-hidden="true" />
<span>{helpfulOn ? helpfulPressedLabel : helpfulLabel}</span>
</button>
</div>
<div className="cf-dt-labelrow">
<label htmlFor={`${uid}-note`} className="cf-dt-label">
{fieldLabel}
</label>
<span className={`cf-dt-counter${value.length >= maxLength * 0.9 ? " is-near" : ""}`} aria-hidden="true">
{counter}
</span>
</div>
<textarea
ref={fieldRef}
id={`${uid}-note`}
name="comment"
className="cf-dt-field"
placeholder={placeholder}
maxLength={maxLength}
value={value}
onChange={handleChange}
disabled={disabled}
aria-invalid={showError || undefined}
aria-describedby={showError ? `${uid}-err` : undefined}
/>
{showError && (
<p id={`${uid}-err`} className="cf-dt-error" role="alert">
<AlertCircle className="cf-dt-inl" size={16} strokeWidth={2.5} aria-hidden="true" />
{errorMessage}
</p>
)}
<button type="submit" className={postClass} disabled={disabled || submitting} aria-busy={submitting || undefined}>
{submitting && <Loader2 className="cf-dt-spin" size={20} strokeWidth={2.5} aria-hidden="true" />}
<span>{submitting ? postingLabel : postLabel}</span>
</button>
{secondaryLine && (
<p className="cf-dt-alt">
<a href={`#${uid}-thread`}>{secondaryLine}</a>
</p>
)}
</form>
<div id={`${uid}-thread`} className="cf-dt-thread">
{comments.length === 0 ? (
<div className="cf-dt-empty">
<Spot src={community} size={72} />
<h3 className="cf-dt-empty-title">{emptyTitle}</h3>
<p className="cf-dt-empty-body">{emptyBody}</p>
</div>
) : (
<>
<div className="cf-dt-bar">
<h3 className="cf-dt-count">{countText}</h3>
<span className="cf-dt-sort">{sortLabel}</span>
</div>
<ol className="cf-dt-list" role="list">
{comments.map((c, i) => renderComment(c, i, "c", 0))}
</ol>
{hasMore && (
<button
type="button"
className="cf-dt-more"
onClick={() => onLoadMore?.()}
disabled={loadingMore}
aria-busy={loadingMore || undefined}
>
{loadingMore && <Loader2 className="cf-dt-spin" size={20} strokeWidth={2.5} aria-hidden="true" />}
<span>{loadingMore ? loadingLabel : moreLabel}</span>
</button>
)}
</>
)}
</div>
</div>
</section>
);
}
export default DiscussionThread;
function markPhrase(text: string, phrase?: string): React.ReactNode {
if (!phrase) return text;
const at = text.indexOf(phrase);
if (at < 0) return text;
return (
<>
{text.slice(0, at)}
<span className="cf-dt-mark">{phrase}</span>
{text.slice(at + phrase.length)}
</>
);
}
function initials(name: string): string {
return name
.split(" ")
.filter(Boolean)
.slice(0, 2)
.map((part) => part[0])
.join("")
.toUpperCase();
}
function countAll(list: DiscussionComment[]): number {
return list.reduce((n, c) => n + 1 + countAll(c.replies ?? []), 0);
}
const CSS = `
.cf-discussion-thread{position:relative;isolation:isolate;overflow:hidden;background:var(--surface,#fff);color:var(--ink,#1a2233);font-family:var(--font-body);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px)}
.cf-discussion-thread *,.cf-discussion-thread *::before,.cf-discussion-thread *::after{box-sizing:border-box}
.cf-dt-inner{position:relative;z-index:1;max-width:46rem;margin-inline:auto;text-align:center}
.cf-dt-title{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;text-wrap:balance;color:var(--ink)}
.cf-dt-mark{background-image:linear-gradient(transparent 50%,var(--marker,#fae37c) 50%,var(--marker,#fae37c) 92%,transparent 92%);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-inline:.06em;margin-inline:-.06em;border-radius:.15em}
.cf-dt-lead{margin-top:16px;display:grid;gap:2px;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted)}
.cf-dt-lead p{margin:0;text-wrap:pretty}
.cf-dt-lead p:last-child{margin-top:6px;color:var(--ink);font-family:var(--font-display);font-weight:800;letter-spacing:-.01em}
.cf-dt-pin{display:inline-flex;align-items:center;gap:10px;max-width:100%;margin:24px 0 0;padding:6px 16px 6px 6px;border-radius:999px;background:color-mix(in oklch,var(--ink) 5%,var(--surface));color:var(--ink);font-size:.9375rem;font-weight:500;line-height:1.35;text-align:left}
.cf-dt-pin strong{font-weight:800}
.cf-dt-pin-img{flex:none;width:36px;height:36px;border-radius:999px;object-fit:cover}
.cf-dt-pin-icon{display:grid;place-items:center;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card))}
.cf-dt-inl{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em}
.cf-dt-card{margin-top:32px;text-align:left;background:var(--card,#fff);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) 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)));padding:clamp(20px,3vw,32px)}
.cf-dt-cardhead{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 16px;padding-bottom:20px;margin-bottom:20px;border-bottom:1px solid oklch(from var(--ink) l c h / .12)}
.cf-dt-q{margin:0;font-family:var(--font-display);font-size:clamp(1.125rem,1.5vw,1.375rem);font-weight:800;line-height:1.25;letter-spacing:-.01em;text-wrap:balance}
.cf-dt-help{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px 0 14px;border-radius:999px;border:1px solid var(--button-2-border,transparent);background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:var(--button-2-shadow,var(--shadow-sm));font-family:var(--font-body);font-size:.9375rem;font-weight:800;line-height:1.15;cursor:pointer;transition:background .16s ease,color .16s ease,transform .16s ease}
.cf-dt-help:hover:not(:disabled){background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - 0.04) c h)}
.cf-dt-help:active:not(:disabled){transform:translateY(1px)}
.cf-dt-help[aria-pressed=true]{background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));border-color:transparent}
.cf-dt-help[aria-pressed=true]:hover:not(:disabled){background:oklch(from var(--accent-fill,var(--accent)) calc(l - 0.05) c h)}
.cf-dt-help[aria-pressed=true] svg{fill:currentColor;animation:cf-dt-pop .3s ease both}
.cf-dt-help:disabled{cursor:not-allowed;opacity:.6}
.cf-dt-labelrow{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:8px}
.cf-dt-label{font-size:1.0625rem;font-weight:700;color:var(--label-ink,var(--ink))}
.cf-dt-counter{flex:none;font-size:.875rem;font-weight:600;color:var(--muted);font-variant-numeric:tabular-nums;transition:color .16s ease}
.cf-dt-counter.is-near{color:var(--warning,var(--ink));font-weight:800}
.cf-dt-field{display:block;width:100%;min-height:128px;max-height:320px;resize:vertical;margin:0;padding:14px 16px;background:var(--field,#fff);color:var(--field-ink,#101828);border:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));font-family:var(--font-body);font-size:1.0625rem;line-height:1.5;transition:border-color .16s ease,box-shadow .16s ease}
.cf-dt-field::placeholder{color:color-mix(in oklch,var(--field-ink,#101828) 65%,var(--field,#fff));opacity:1}
.cf-dt-field:hover:not(:disabled){border-color:color-mix(in oklch,var(--ink) 40%,transparent)}
.cf-dt-field:focus{outline:none;border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent)) l c h / .35)}
.cf-dt-field[aria-invalid=true]{border-color:var(--danger);box-shadow:0 0 0 3px oklch(from var(--danger) l c h / .22)}
.cf-dt-field:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--ink) 4%,var(--field,#fff))}
.cf-dt-error{margin:8px 0 0;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--danger);text-wrap:pretty}
.cf-dt-post{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:56px;margin-top:16px;padding:0 28px;border:0;cursor:pointer;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;color:var(--button-ink,var(--cta-ink,#fff));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l + 0.04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + 0.14) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .3),0 8px 16px -6px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .45));transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-dt-post:hover:not(:disabled),.cf-dt-post.is-hover{background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - 0.01) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.07) c h));transform:translateY(-1px);box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + 0.14) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .32),0 12px 20px -6px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .5))}
.cf-dt-post:active:not(:disabled),.cf-dt-post.is-active{transform:translateY(1px);box-shadow:inset 0 2px 4px oklch(from var(--button-bg,var(--cta)) calc(l - 0.22) c h / .55),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .3)}
.cf-dt-post:disabled:not(.is-busy){background:var(--secondary);color:var(--secondary-ink);box-shadow:none;text-shadow:none;cursor:not-allowed}
.cf-dt-post.is-busy{cursor:progress}
.cf-dt-alt{margin:12px 0 0;text-align:center;font-size:.9375rem;line-height:1.4;text-wrap:pretty}
.cf-dt-alt a{color:var(--muted);font-weight:600;text-decoration:underline;text-decoration-color:oklch(from var(--muted) l c h / .45);text-underline-offset:.18em}
.cf-dt-alt a:hover{color:var(--ink);text-decoration-color:currentColor}
.cf-dt-thread{margin-top:40px;text-align:left;scroll-margin-top:24px;background:var(--card,#fff);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-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)));padding:clamp(20px,3vw,32px)}
.cf-dt-bar{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 16px;padding-bottom:16px;border-bottom:1px solid oklch(from var(--ink) l c h / .14)}
.cf-dt-count{margin:0;font-family:var(--font-display);font-size:clamp(1.3125rem,1.8vw,1.625rem);font-weight:800;letter-spacing:-.01em;line-height:1.15;font-variant-numeric:tabular-nums}
.cf-dt-sort{font-size:.9375rem;font-weight:600;color:var(--muted)}
.cf-dt-list,.cf-dt-replies{list-style:none;margin:0;padding:0}
.cf-dt-item{display:grid;grid-template-columns:44px minmax(0,1fr);gap:16px;padding:20px 0;border-bottom:1px solid oklch(from var(--ink) l c h / .1)}
.cf-dt-list > .cf-dt-item{animation:cf-dt-rise .45s cubic-bezier(.2,.7,.2,1) both}
.cf-dt-list > .cf-dt-item:last-child{border-bottom:0;padding-bottom:4px}
.cf-dt-av{display:grid;place-items:center;width:44px;height:44px;border-radius:999px;object-fit:cover;background:var(--secondary);color:var(--secondary-ink);font-family:var(--font-display);font-weight:800;font-size:.9375rem;letter-spacing:.01em}
.cf-dt-init.is-host{background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card))}
.cf-dt-body{min-width:0}
.cf-dt-head{margin:0;display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;line-height:1.3}
.cf-dt-name{font-size:1.0625rem;font-weight:800;color:var(--ink)}
.cf-dt-host{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));font-size:.875rem;font-weight:800;line-height:1}
.cf-dt-meta{font-size:.9375rem;font-weight:500;color:var(--muted)}
.cf-dt-text{margin-top:6px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--ink);text-wrap:pretty;overflow-wrap:anywhere}
.cf-dt-text p{margin:0}
.cf-dt-actions{display:flex;flex-wrap:wrap;gap:4px;margin:6px 0 0 -12px}
.cf-dt-act{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 12px;border:1px solid transparent;border-radius:var(--button-radius,var(--radius,12px));background:transparent;color:var(--muted);font-family:var(--font-body);font-size:.9375rem;font-weight:700;line-height:1.15;cursor:pointer;transition:background .16s ease,color .16s ease,border-color .16s ease,transform .16s ease}
.cf-dt-act:hover{background:var(--button-2-bg,var(--secondary));border-color:var(--button-2-border,transparent);color:var(--button-2-ink,var(--secondary-ink))}
.cf-dt-act:active{transform:translateY(1px)}
.cf-dt-act[aria-pressed=true]{color:var(--accent)}
.cf-dt-act[aria-pressed=true] svg{fill:currentColor;animation:cf-dt-pop .3s ease both}
.cf-dt-num{font-variant-numeric:tabular-nums}
.cf-dt-replies{margin-top:4px}
.cf-dt-item.is-reply{grid-template-columns:36px minmax(0,1fr);gap:12px;padding:16px 0 0;border-bottom:0}
.cf-dt-item.is-reply > .cf-dt-av{width:36px;height:36px;font-size:.875rem}
.cf-dt-more{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:56px;margin-top:24px;padding:0 28px;border:1px solid var(--button-2-border,transparent);border-radius:var(--button-radius,var(--radius,12px));background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:var(--button-2-shadow,var(--shadow-sm));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:1.0625rem;line-height:1.15;cursor:pointer;transition:background .16s ease,transform .16s ease}
.cf-dt-more:hover:not(:disabled){background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - 0.04) c h)}
.cf-dt-more:active:not(:disabled){transform:translateY(1px)}
.cf-dt-more:disabled{cursor:progress}
.cf-dt-empty{display:grid;justify-items:center;gap:8px;padding:clamp(24px,4vw,40px) clamp(20px,3vw,32px);border-radius:10px;background:color-mix(in oklch,var(--ink) 4%,var(--card,#fff));text-align:center}
.cf-dt-empty-title{margin:8px 0 0;font-family:var(--font-display);font-size:clamp(1.3125rem,1.8vw,1.625rem);font-weight:800;letter-spacing:-.01em;line-height:1.15;text-wrap:balance;color:var(--ink)}
.cf-dt-empty-body{margin:0;max-width:40ch;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--ink);text-wrap:pretty}
.cf-dt-spin{animation:cf-dt-spin .8s linear infinite}
.cf-discussion-thread :is(button,a):focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / .6);outline-offset:3px}
@keyframes cf-dt-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes cf-dt-pop{from{transform:scale(.9)}to{transform:scale(1)}}
@keyframes cf-dt-spin{to{transform:rotate(360deg)}}
@media (max-width:560px){
.cf-dt-item{grid-template-columns:40px minmax(0,1fr);gap:12px}
.cf-dt-av{width:40px;height:40px}
.cf-dt-help{width:100%}
.cf-dt-post{padding:0 20px}
.cf-dt-thread{padding:20px 16px}
.cf-dt-item.is-reply{grid-template-columns:32px minmax(0,1fr);gap:10px}
.cf-dt-item.is-reply > .cf-dt-av{width:32px;height:32px}
}
@media (prefers-reduced-motion:reduce){
.cf-dt-list > .cf-dt-item,.cf-dt-help[aria-pressed=true] svg,.cf-dt-act[aria-pressed=true] svg,.cf-dt-spin{animation:none}
.cf-dt-post,.cf-dt-help,.cf-dt-act,.cf-dt-more,.cf-dt-field,.cf-dt-counter{transition:none}
.cf-dt-post:hover:not(:disabled),.cf-dt-post.is-hover,.cf-dt-post:active:not(:disabled),.cf-dt-post.is-active,.cf-dt-help:active:not(:disabled),.cf-dt-act:active,.cf-dt-more:active:not(:disabled){transform:none}
}
`;
pieces/content/discussion-thread/specimen.tsx 79 lines
import __studioImage719b78ff from "../assets/987b265a80aa8b9c.webp";
import DiscussionThread from "../discussion-thread";
import defaults from "../../studio-defaults.json";
import { slot } from "../../slots";
export const states = ["default", "hover", "active", "disabled", "error"];
type State = "default" | "hover" | "active" | "disabled" | "error";
export default function DiscussionThreadSpecimen({ state = "default" }: { state?: State }) {
const workshop = defaults.sample.registration.name;
return (
<DiscussionThread
state={state}
headline="Mark this lesson helpful, then post your best takeaway below."
highlight="best takeaway"
leadLines={[
`Finished lesson one of the ${workshop}?`,
"Write down the one idea you'll put to work first.",
"Post it below.",
"Done.",
]}
hostName="Alex Rivera"
presenterImage={slot(
"presenter",
__studioImage719b78ff
)}
totalCount={48}
hasMore
comments={[
{
id: "maya",
name: "Maya L.",
meta: "Denver · 12 min ago",
body: "My offer page had four buttons doing four different jobs. Tonight I cut it to one. The page finally knows what it wants.",
helpfulCount: 9,
replies: [
{
id: "maya-host",
name: "Alex Rivera",
isHost: true,
meta: "4 min ago",
body: "That's the whole lesson in one move. Bring that page with you to video two.",
},
],
},
{
id: "jordan",
name: "Jordan P.",
meta: "Leeds · 38 min ago",
body: "Writing the headline before touching the layout changed everything. I'd been designing around a promise I hadn't written yet.",
helpfulCount: 5,
},
{
id: "priya",
name: "Priya S.",
meta: "Toronto · 1 hr ago",
body: "Question for Alex: does the one-action rule apply to the thank-you page too, or can it point to two places?",
replies: [
{
id: "priya-host",
name: "Alex Rivera",
isHost: true,
meta: "52 min ago",
body: "One action there too. Point it at the next step you most want them to take.",
},
],
},
{
id: "sam",
name: "Sam K.",
meta: "Bristol · 2 hr ago",
body: "Mapped my whole funnel on one sheet with the Page Copy Workbook. Three pages. One action each. Done.",
helpfulCount: 3,
},
]}
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalDiscussionThread |
string |
|
highlight OptionalDiscussionThread |
string |
|
leadLines OptionalDiscussionThread |
string[] |
|
hostName OptionalDiscussionThread |
string |
|
presenterImage OptionalDiscussionThread |
string |
|
pinnedLabel OptionalDiscussionThread |
string |
|
helpfulQuestion OptionalDiscussionThread |
string |
|
helpfulLabel OptionalDiscussionThread |
string |
|
helpfulPressedLabel OptionalDiscussionThread |
string |
|
helpful OptionalDiscussionThread |
boolean |
|
onHelpful OptionalDiscussionThread |
(pressed: boolean) => void |
|
fieldLabel OptionalDiscussionThread |
string |
|
placeholder OptionalDiscussionThread |
string |
|
minLength OptionalDiscussionThread |
number |
|
maxLength OptionalDiscussionThread |
number |
|
counterLabel OptionalDiscussionThread |
string |
|
postLabel OptionalDiscussionThread |
string |
|
postingLabel OptionalDiscussionThread |
string |
|
secondaryLine OptionalDiscussionThread |
string |
|
errorMessage OptionalDiscussionThread |
string |
|
comments OptionalDiscussionThread |
DiscussionComment[] |
|
totalCount OptionalDiscussionThread |
number |
|
countLabel OptionalDiscussionThread |
string |
|
countLabelOne OptionalDiscussionThread |
string |
|
sortLabel OptionalDiscussionThread |
string |
|
hostBadge OptionalDiscussionThread |
string |
|
commentHelpfulLabel OptionalDiscussionThread |
string |
|
replyLabel OptionalDiscussionThread |
string |
|
replyAriaLabel OptionalDiscussionThread |
string |
|
hasMore OptionalDiscussionThread |
boolean |
|
loadingMore OptionalDiscussionThread |
boolean |
|
moreLabel OptionalDiscussionThread |
string |
|
loadingLabel OptionalDiscussionThread |
string |
|
emptyTitle OptionalDiscussionThread |
string |
|
emptyBody OptionalDiscussionThread |
string |
|
submitting OptionalDiscussionThread |
boolean |
|
onSubmit OptionalDiscussionThread |
(values: { comment: string }) => void |
|
onReply OptionalDiscussionThread |
(comment: DiscussionComment) => void |
|
onCommentHelpful OptionalDiscussionThread |
(comment: DiscussionComment, pressed: boolean) => void |
|
onLoadMore OptionalDiscussionThread |
() => void |
|
state OptionalDiscussionThread |
"default" | "hover" | "active" | "disabled" | "error" |
|
className OptionalDiscussionThread |
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--field-border--field-focus--field-ink--field-radius- 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.
presenter- A photo of the host, coach or founder.
-
2c539f422023a290.webp
image/webp · 115 KB
-
5602e47ebdb81810.webp
image/webp · 35.6 KB
-
987b265a80aa8b9c.webp
image/webp · 102 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB