"use client" import { Button } from "@/components/ui/button" import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible" import { cn } from "@/lib/utils" import { BarChart3, BookOpen, ChevronDown, Code, CreditCard, DollarSign, HelpCircle, Mail, MessageCircle, } from "lucide-react" import Link from "next/link" import type React from "react" import { useState } from "react" interface FAQ { id: string question: string answer: string icon: React.ReactNode category: string } interface FAQBlockProps { title?: string subtitle?: string linkText?: string linkHref?: string categories?: string[] faqs?: FAQ[] className?: string } const defaultFAQs: FAQ[] = [ { id: "1", question: "Is there a free trial available?", answer: "Yes, you can try us for free for 30 days. If you want, we'll provide you with a free 30-minute onboarding call to get you up and running. Book a call here.", icon: , category: "General", }, { id: "2", question: "Can I change my plan later?", answer: "Of course! Our pricing scales with your company. Chat to our friendly team to find a solution that works for you.", icon: , category: "Pricing", }, { id: "3", question: "What is your cancellation policy?", answer: "We understand that things change. You can cancel your plan at any time and we'll refund you the difference already paid.", icon: , category: "General", }, { id: "4", question: "Can other info be added to an invoice?", answer: "Yes, you can easily add additional information to your invoices such as your VAT number, company address, and purchase order numbers.", icon: , category: "API", }, { id: "5", question: "How does billing work?", answer: "Plans are per workspace, not per account. You can upgrade one workspace, and still have any number of free workspaces.", icon: , category: "Pricing", }, { id: "6", question: "How do I change my account email?", answer: "You can change the email address associated with your account by going to your account settings and updating your profile information.", icon: , category: "General", }, { id: "7", question: "How does support work?", answer: "We provide email and chat support to all users. Premium users also get access to phone support and priority assistance.", icon: , category: "General", }, { id: "8", question: "Do you provide tutorials?", answer: "Yes! We have a comprehensive knowledge base with step-by-step tutorials, video guides, and best practices to help you get the most out of our platform.", icon: , category: "General", }, ] export default function FAQ({ title = "Frequently asked questions", subtitle = "These are the most commonly asked questions about Untitled UI. Can't find what you're looking for?", linkText = "Chat to our friendly team!", linkHref = "#", categories = ["General", "Pricing", "Dashboard", "API"], faqs = defaultFAQs, className, }: FAQBlockProps) { const [activeCategory, setActiveCategory] = useState(categories[0]) const [openItems, setOpenItems] = useState(["1"]) // First item open by default const filteredFAQs = faqs.filter((faq) => faq.category === activeCategory) const toggleItem = (id: string) => { setOpenItems((prev) => (prev.includes(id) ? prev.filter((item) => item !== id) : [...prev, id])) } return (

{title}

{subtitle}{" "} {linkText}

{categories.map((category) => ( ))}
{filteredFAQs.map((faq, index) => ( toggleItem(faq.id)}>
{faq.icon}

{faq.question}

{faq.answer}
))}
{filteredFAQs.length === 0 && (

No FAQs found

There are no frequently asked questions in the {activeCategory} category yet.

)}
) }