Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | 'use client'; |
| 2 | |
| 3 | import Link from 'next/link'; |
| 4 | import Image from 'next/image'; |
| 5 | import { ExternalLink } from 'lucide-react'; |
| 6 | |
| 7 | interface TemplateCardProps { |
| 8 | title: string; |
| 9 | description: string; |
| 10 | href: string; |
| 11 | image?: string; |
| 12 | } |
| 13 | |
| 14 | export function TemplateCard({ |
| 15 | title, |
| 16 | description, |
| 17 | href, |
| 18 | image, |
| 19 | }: TemplateCardProps) { |
| 20 | const isVideo = image?.endsWith('.mp4') || image?.endsWith('.webm'); |
| 21 | |
| 22 | if (image) { |
| 23 | return ( |
| 24 | <Link |
| 25 | href={href} |
| 26 | target="_blank" |
| 27 | rel="noopener noreferrer" |
| 28 | className="flex flex-col sm:flex-row items-start gap-8 rounded-xl border border-fd-border bg-fd-card p-8 transition-all hover:border-[color-mix(in_srgb,var(--composio-orange)_50%,transparent)] [text-decoration:none] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2" |
| 29 | > |
| 30 | <div className="flex flex-col gap-3 sm:w-1/2 shrink-0 pt-2"> |
| 31 | <h3 className="text-xl font-bold text-fd-foreground">{title}</h3> |
| 32 | <p className="text-sm text-fd-muted-foreground leading-relaxed">{description}</p> |
| 33 | </div> |
| 34 | <div className="overflow-hidden rounded-xl shadow-lg sm:w-1/2 max-w-sm"> |
| 35 | {isVideo ? ( |
| 36 | <video |
| 37 | src={image} |
| 38 | autoPlay |
| 39 | loop |
| 40 | muted |
| 41 | playsInline |
| 42 | aria-label={`${title} demo video`} |
| 43 | className="w-full h-auto object-cover" |
| 44 | /> |
| 45 | ) : ( |
| 46 | <Image |
| 47 | src={image} |
| 48 | alt={`${title} preview`} |
| 49 | width={600} |
| 50 | height={340} |
| 51 | className="w-full h-auto object-cover" |
| 52 | unoptimized={image.endsWith('.gif')} |
| 53 | /> |
| 54 | )} |
| 55 | </div> |
| 56 | </Link> |
| 57 | ); |
| 58 | } |
| 59 | |
| 60 | return ( |
| 61 | <Link |
| 62 | href={href} |
| 63 | target="_blank" |
| 64 | rel="noopener noreferrer" |
| 65 | className="flex flex-col rounded-xl border border-fd-border bg-fd-card overflow-hidden transition-all hover:border-[color-mix(in_srgb,var(--composio-orange)_50%,transparent)] [text-decoration:none]" |
| 66 | > |
| 67 | <div className="flex items-center justify-between p-5 pb-3"> |
| 68 | <h3 className="text-base font-semibold text-fd-foreground">{title}</h3> |
| 69 | <ExternalLink className="h-4 w-4 shrink-0 text-fd-muted-foreground" /> |
| 70 | </div> |
| 71 | <div className="flex flex-col gap-3 p-5 pt-0 flex-1"> |
| 72 | <p className="text-sm text-fd-muted-foreground leading-relaxed">{description}</p> |
| 73 | </div> |
| 74 | </Link> |
| 75 | ); |
| 76 | } |
| 77 | |
| 78 | export function TemplateGrid({ children, columns = 2 }: { children: React.ReactNode; columns?: 1 | 2 }) { |
| 79 | return ( |
| 80 | <div className={`not-prose grid grid-cols-1 gap-5 ${columns === 2 ? 'sm:grid-cols-2' : ''}`}> |
| 81 | {children} |
| 82 | </div> |
| 83 | ); |
| 84 | } |