{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "testimonials-01",
  "title": "Testimonials 01",
  "description": "A live X testimonial mosaic with resilient fallbacks.",
  "dependencies": [
    "react-tweet"
  ],
  "registryDependencies": [
    "avatar",
    "card"
  ],
  "files": [
    {
      "path": "src/registry/blocks/testimonials-01/testimonials-01.tsx",
      "content": "import type { ReactNode } from \"react\";\nimport { getTweet, type Tweet } from \"react-tweet/api\";\nimport { Avatar, AvatarFallback, AvatarImage } from \"@/components/ui/avatar\";\nimport {\n\tCard,\n\tCardContent,\n\tCardDescription,\n\tCardHeader,\n\tCardTitle,\n} from \"@/components/ui/card\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface TestimonialAuthor {\n\tname: string;\n\thandle: string;\n\tavatarUrl?: string;\n\tverified?: boolean;\n}\n\nexport interface TestimonialData {\n\tid: string;\n\ttext: string;\n\tauthor: TestimonialAuthor;\n}\n\nexport interface TestimonialSource {\n\tid: string;\n\t/** Controls this testimonial's placement in the bento grid. */\n\tclassName?: string;\n\tfallback?: Omit<TestimonialData, \"id\">;\n}\n\nexport interface Testimonials01Props {\n\ttitle?: ReactNode;\n\tdescription?: ReactNode;\n\ttestimonials?: readonly TestimonialSource[];\n\tclassName?: string;\n\tgridClassName?: string;\n}\n\nconst DEFAULT_TESTIMONIALS = [\n\t{\n\t\tid: \"2048474453227540522\",\n\t\tclassName: \"md:col-span-2\",\n\t\tfallback: {\n\t\t\ttext: \"Very consistently looking design, well done :)\",\n\t\t\tauthor: {\n\t\t\t\tname: \"Jarek Avi\",\n\t\t\t\thandle: \"JarekAvi\",\n\t\t\t\tavatarUrl:\n\t\t\t\t\t\"https://pbs.twimg.com/profile_images/2009380291572326400/K1X7xiJd_normal.jpg\",\n\t\t\t\tverified: true,\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tid: \"2049878647591551410\",\n\t\tclassName: \"md:col-span-1\",\n\t\tfallback: {\n\t\t\ttext: \"cool\",\n\t\t\tauthor: {\n\t\t\t\tname: \"Gurbinder\",\n\t\t\t\thandle: \"legionsdev\",\n\t\t\t\tavatarUrl:\n\t\t\t\t\t\"https://pbs.twimg.com/profile_images/1924504051728670720/mqyGd02m_normal.jpg\",\n\t\t\t\tverified: true,\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tid: \"2037743266087756052\",\n\t\tclassName: \"md:col-span-1\",\n\t\tfallback: {\n\t\t\ttext: \"Looks nice!\",\n\t\t\tauthor: {\n\t\t\t\tname: \"Archit\",\n\t\t\t\thandle: \"iarcI3\",\n\t\t\t\tavatarUrl:\n\t\t\t\t\t\"https://pbs.twimg.com/profile_images/2036806514640650240/YwsX6fu4_normal.jpg\",\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tid: \"2036810028838252769\",\n\t\tclassName: \"md:col-span-2\",\n\t\tfallback: {\n\t\t\ttext: \"Clean and fast exactly what we love\",\n\t\t\tauthor: {\n\t\t\t\tname: \"Rohit Girhe\",\n\t\t\t\thandle: \"rohit_girhe\",\n\t\t\t\tavatarUrl:\n\t\t\t\t\t\"https://pbs.twimg.com/profile_images/2010004686737420294/OgjQdz4G_normal.jpg\",\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tid: \"2049014991836086285\",\n\t\tclassName: \"md:col-span-2\",\n\t\tfallback: {\n\t\t\ttext: \"Looks smooth mate 🔥\",\n\t\t\tauthor: {\n\t\t\t\tname: \"Nikolass | Video Editor\",\n\t\t\t\thandle: \"NikolasDesignn\",\n\t\t\t\tavatarUrl:\n\t\t\t\t\t\"https://pbs.twimg.com/profile_images/1615137125573300224/pgKmbZh2_normal.jpg\",\n\t\t\t\tverified: true,\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tid: \"2078686529443316059\",\n\t\tclassName: \"md:col-span-2\",\n\t\tfallback: {\n\t\t\ttext: \"Crazyyy components\",\n\t\t\tauthor: {\n\t\t\t\tname: \"vansh\",\n\t\t\t\thandle: \"vanshdevx\",\n\t\t\t\tavatarUrl:\n\t\t\t\t\t\"https://pbs.twimg.com/profile_images/2043464015289151488/GFtfUf9M_normal.jpg\",\n\t\t\t\tverified: true,\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tid: \"2081023285505007821\",\n\t\tclassName: \"md:col-span-2\",\n\t\tfallback: {\n\t\t\ttext: \"This is a badass library.\",\n\t\t\tauthor: {\n\t\t\t\tname: \"Coin Moebius\",\n\t\t\t\thandle: \"coinmoebius\",\n\t\t\t\tavatarUrl:\n\t\t\t\t\t\"https://pbs.twimg.com/profile_images/2063997511509975040/LE-0tfyw_200x200.jpg\",\n\t\t\t},\n\t\t},\n\t},\n] as const satisfies readonly TestimonialSource[];\n\nfunction cleanText(text: string) {\n\treturn text.replace(/^(@\\w+\\s+)+/, \"\").trim();\n}\n\nfunction normalizeTweet(tweet: Tweet): TestimonialData {\n\tconst { user } = tweet;\n\n\treturn {\n\t\tid: tweet.id_str,\n\t\ttext: cleanText(tweet.text),\n\t\tauthor: {\n\t\t\tname: user.name,\n\t\t\thandle: user.screen_name,\n\t\t\tavatarUrl: user.profile_image_url_https,\n\t\t\tverified: Boolean(\n\t\t\t\tuser.verified || user.is_blue_verified || user.verified_type,\n\t\t\t),\n\t\t},\n\t};\n}\n\nasync function resolveTestimonial(source: TestimonialSource) {\n\tconst fallback = source.fallback\n\t\t? { ...source.fallback, id: source.id }\n\t\t: null;\n\n\ttry {\n\t\tconst tweet = await getTweet(source.id);\n\t\treturn tweet ? normalizeTweet(tweet) : fallback;\n\t} catch {\n\t\treturn fallback;\n\t}\n}\n\nfunction XLogo({ className }: { className?: string }) {\n\treturn (\n\t\t<svg\n\t\t\taria-hidden=\"true\"\n\t\t\tclassName={className}\n\t\t\tfill=\"currentColor\"\n\t\t\tviewBox=\"0 0 24 24\"\n\t\t>\n\t\t\t<path d=\"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77z\" />\n\t\t</svg>\n\t);\n}\n\nfunction VerifiedMark() {\n\treturn (\n\t\t<svg\n\t\t\taria-label=\"Verified\"\n\t\t\tclassName=\"size-3.5 shrink-0 text-[#1d9bf0]\"\n\t\t\tfill=\"currentColor\"\n\t\t\tviewBox=\"0 0 22 22\"\n\t\t>\n\t\t\t<path d=\"M20.396 11c-.018-.646-.215-1.275-.57-1.816-.354-.54-.852-.972-1.438-1.246.223-.607.27-1.264.14-1.897-.131-.634-.437-1.218-.882-1.687-.47-.445-1.053-.75-1.687-.882-.633-.13-1.29-.083-1.897.14-.273-.587-.704-1.086-1.245-1.44C12.275 1.819 11.647 1.62 11 1.604c-.646.017-1.275.213-1.815.568s-.972.854-1.246 1.44c-.608-.223-1.264-.27-1.898-.14-.633.13-1.217.437-1.687.882-.445.47-.751 1.053-.882 1.687-.13.633-.083 1.29.14 1.897-.586.274-1.086.705-1.44 1.246-.354.54-.55 1.17-.569 1.816.018.646.215 1.275.57 1.816.354.54.853.972 1.439 1.246-.223.607-.27 1.264-.14 1.897.131.634.437 1.218.882 1.687.47.445 1.053.751 1.687.882.633.131 1.29.083 1.897-.14.274.587.705 1.086 1.246 1.44.54.354 1.17.551 1.816.569.646-.018 1.275-.215 1.816-.57.54-.354.972-.852 1.246-1.439.607.223 1.264.27 1.897.14.634-.131 1.218-.437 1.687-.882.445-.47.751-1.053.882-1.687.13-.633.083-1.29-.14-1.897.587-.274 1.086-.705 1.44-1.246.354-.54.551-1.17.569-1.816zM9.662 14.85l-3.429-3.428 1.293-1.302 2.072 2.072 4.4-4.794 1.347 1.246z\" />\n\t\t</svg>\n\t);\n}\n\nfunction initials(name: string) {\n\treturn name\n\t\t.split(\" \")\n\t\t.map((part) => part[0])\n\t\t.join(\"\")\n\t\t.slice(0, 2)\n\t\t.toUpperCase();\n}\n\nfunction AuthorAvatar({ author }: { author: TestimonialAuthor }) {\n\tconst avatarUrl = author.avatarUrl?.replace(\"_normal.\", \"_bigger.\");\n\n\treturn (\n\t\t<Avatar className=\"size-9\">\n\t\t\t{avatarUrl ? <AvatarImage alt={author.name} src={avatarUrl} /> : null}\n\t\t\t<AvatarFallback className=\"bg-foreground font-mono text-[11px] text-background\">\n\t\t\t\t{initials(author.name)}\n\t\t\t</AvatarFallback>\n\t\t</Avatar>\n\t);\n}\n\nfunction Quote({ text }: { text: string }) {\n\tconst wordCount = text.split(/\\s+/).length;\n\tconst isShort = wordCount <= 2;\n\tconst isLong = wordCount > 18;\n\tconst punctuated = /[.!?]$/.test(text) ? text : `${text}.`;\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"flex flex-1 items-center py-2\"\n\t\t\tdata-slot=\"testimonial-quote-wrapper\"\n\t\t>\n\t\t\t<blockquote\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"text-pretty font-serif text-foreground tracking-tight\",\n\t\t\t\t\tisShort &&\n\t\t\t\t\t\t\"mx-auto text-center text-[clamp(3rem,12cqi,4.5rem)] italic leading-none\",\n\t\t\t\t\t!isShort &&\n\t\t\t\t\t\t!isLong &&\n\t\t\t\t\t\t\"text-[clamp(1.0625rem,5cqi,3rem)] leading-[1.12]\",\n\t\t\t\t\tisLong && \"text-[clamp(1.0625rem,3.5cqi,2rem)] leading-[1.2]\",\n\t\t\t\t)}\n\t\t\t\tdata-slot=\"testimonial-quote\"\n\t\t\t>\n\t\t\t\t{isShort ? punctuated : <>&ldquo;{text}&rdquo;</>}\n\t\t\t</blockquote>\n\t\t</div>\n\t);\n}\n\nfunction TestimonialCard({ testimonial }: { testimonial: TestimonialData }) {\n\tconst { author } = testimonial;\n\tconst url = `https://x.com/${author.handle}/status/${testimonial.id}`;\n\n\treturn (\n\t\t<a\n\t\t\taria-label={`Read @${author.handle}'s post on X`}\n\t\t\tclassName=\"group/card block h-full rounded-xl transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 focus-visible:ring-offset-background active:scale-[0.995] motion-reduce:transition-none\"\n\t\t\thref={url}\n\t\t\trel=\"noreferrer\"\n\t\t\ttarget=\"_blank\"\n\t\t>\n\t\t\t<Card className=\"@container/testimonial h-full gap-5 bg-card py-0\">\n\t\t\t\t<CardHeader className=\"flex flex-row items-start justify-between gap-3 px-5 pt-5 sm:px-6 sm:pt-6\">\n\t\t\t\t\t<div className=\"flex min-w-0 items-center gap-3\">\n\t\t\t\t\t\t<AuthorAvatar author={author} />\n\t\t\t\t\t\t<div className=\"flex min-w-0 flex-col leading-tight\">\n\t\t\t\t\t\t\t<CardTitle className=\"flex items-center gap-1 font-medium font-sans text-sm leading-tight\">\n\t\t\t\t\t\t\t\t<span className=\"truncate\">{author.name}</span>\n\t\t\t\t\t\t\t\t{author.verified ? <VerifiedMark /> : null}\n\t\t\t\t\t\t\t</CardTitle>\n\t\t\t\t\t\t\t<CardDescription className=\"truncate font-mono text-[11px] leading-tight\">\n\t\t\t\t\t\t\t\t@{author.handle}\n\t\t\t\t\t\t\t</CardDescription>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<XLogo className=\"size-4 shrink-0 text-muted-foreground/70 transition-colors duration-160 ease-[cubic-bezier(0.23,1,0.32,1)] [@media(hover:hover)_and_(pointer:fine)]:group-hover/card:text-foreground\" />\n\t\t\t\t</CardHeader>\n\n\t\t\t\t<CardContent className=\"flex flex-1 flex-col px-5 pb-5 sm:px-6 sm:pb-6\">\n\t\t\t\t\t<Quote text={testimonial.text} />\n\t\t\t\t</CardContent>\n\t\t\t</Card>\n\t\t</a>\n\t);\n}\n\nexport default async function Testimonials01({\n\ttitle = \"Loved by thousands of people.\",\n\tdescription = \"Here’s what some of our users have to say.\",\n\ttestimonials = DEFAULT_TESTIMONIALS,\n\tclassName,\n\tgridClassName,\n}: Testimonials01Props = {}) {\n\tconst resolved = await Promise.all(\n\t\ttestimonials.map(async (source) => ({\n\t\t\tsource,\n\t\t\ttestimonial: await resolveTestimonial(source),\n\t\t})),\n\t);\n\tconst available = resolved.filter(\n\t\t(\n\t\t\titem,\n\t\t): item is {\n\t\t\tsource: TestimonialSource;\n\t\t\ttestimonial: TestimonialData;\n\t\t} => item.testimonial !== null,\n\t);\n\n\tif (available.length === 0) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<section\n\t\t\tclassName={cn(\n\t\t\t\t\"w-full bg-background px-2 py-20 font-sans sm:py-24 md:px-6 md:py-28\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<div className=\"mx-auto w-full max-w-6xl\">\n\t\t\t\t<header className=\"px-4 pb-12 md:px-2\">\n\t\t\t\t\t<h2 className=\"max-w-2xl text-balance font-serif text-4xl text-foreground leading-[1.05] tracking-tight sm:text-5xl md:text-6xl\">\n\t\t\t\t\t\t{title}\n\t\t\t\t\t</h2>\n\t\t\t\t\t<p className=\"mt-4 max-w-xl text-pretty text-base text-muted-foreground leading-relaxed sm:text-lg\">\n\t\t\t\t\t\t{description}\n\t\t\t\t\t</p>\n\t\t\t\t</header>\n\n\t\t\t\t<div\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"grid grid-cols-1 gap-2 px-2 md:auto-rows-[minmax(220px,1fr)] md:grid-cols-4 md:gap-1\",\n\t\t\t\t\t\tgridClassName,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{available.map(({ source, testimonial }) => (\n\t\t\t\t\t\t<div className={source.className} key={source.id}>\n\t\t\t\t\t\t\t<TestimonialCard testimonial={testimonial} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>\n\t);\n}\n",
      "type": "registry:component",
      "target": "@components/testimonials-01.tsx"
    }
  ],
  "meta": {
    "createdAt": "2026-07-21",
    "iframeHeight": 1320,
    "previewClassName": "min-h-screen"
  },
  "categories": [
    "testimonials"
  ],
  "type": "registry:block"
}