Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 03:37 UTC
| 1 | 'use client'; |
| 2 | |
| 3 | import { HelpCircle } from 'lucide-react'; |
| 4 | import { Tabs, Tab } from 'fumadocs-ui/components/tabs'; |
| 5 | import type { FaqItem } from '@/lib/toolkit-faq'; |
| 6 | |
| 7 | export type { FaqItem } from '@/lib/toolkit-faq'; |
| 8 | |
| 9 | interface FaqSectionProps { |
| 10 | faq: FaqItem[]; |
| 11 | } |
| 12 | |
| 13 | export function FaqSection({ faq }: FaqSectionProps) { |
| 14 | if (!faq || faq.length === 0) return null; |
| 15 | |
| 16 | return ( |
| 17 | <div className="space-y-3"> |
| 18 | <h2 className="flex items-center gap-2 text-base font-semibold text-fd-foreground"> |
| 19 | <HelpCircle className="h-4 w-4" /> |
| 20 | Frequently Asked Questions |
| 21 | </h2> |
| 22 | <div className="divide-y divide-fd-border overflow-hidden rounded-lg border bg-fd-card"> |
| 23 | {faq.map((item) => ( |
| 24 | <details key={item.question}> |
| 25 | <summary |
| 26 | className="cursor-pointer px-3 py-2.5 text-sm font-medium focus-visible:outline focus-visible:outline-2 focus-visible:outline-fd-ring" |
| 27 | > |
| 28 | {item.question} |
| 29 | </summary> |
| 30 | {/* Target the answer so native fragment navigation opens its details. */} |
| 31 | <div |
| 32 | id={item.question.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '')} |
| 33 | className="scroll-m-24 px-4 pb-2" |
| 34 | > |
| 35 | {item.answer.map((part, index) => part.type === 'html' ? ( |
| 36 | <div key={index} |
| 37 | className="prose prose-sm prose-fd max-w-none text-fd-muted-foreground" |
| 38 | dangerouslySetInnerHTML={{ __html: part.html }} |
| 39 | /> |
| 40 | ) : ( |
| 41 | <Tabs key={index} groupId="language" items={part.tabs.map((tab) => tab.value)} persist> |
| 42 | {part.tabs.map((tab) => ( |
| 43 | <Tab key={tab.value} value={tab.value}> |
| 44 | <div className="prose prose-sm prose-fd max-w-none overflow-x-auto" |
| 45 | dangerouslySetInnerHTML={{ __html: tab.html }} |
| 46 | /> |
| 47 | </Tab> |
| 48 | ))} |
| 49 | </Tabs> |
| 50 | ))} |
| 51 | </div> |
| 52 | </details> |
| 53 | ))} |
| 54 | </div> |
| 55 | </div> |
| 56 | ); |
| 57 | } |