|
1 | 1 | import Header from '@/sections/Header'; |
2 | 2 | import Footer from '@/sections/Footer'; |
| 3 | +import { useState } from 'react'; |
| 4 | +import { stats } from '@/constants/Stats'; |
| 5 | +import faqs from '@/constants/aboutUs/faqs.ts'; |
3 | 6 |
|
4 | 7 | const FAQs = () => { |
| 8 | + const [openIndex, setOpenIndex] = useState<number | null>(null); |
| 9 | + |
| 10 | + const toggleFAQ = (index: number) => { |
| 11 | + setOpenIndex(openIndex === index ? null : index); |
| 12 | + }; |
| 13 | + |
5 | 14 | return ( |
6 | | - <div> |
| 15 | + <div className="min-h-screen bg-white text-gray-900"> |
7 | 16 | <Header /> |
8 | 17 | <main className="container mx-auto p-4"> |
9 | | - <h1 className="text-4xl font-bold text-center my-8">FAQs</h1> |
10 | | - <div className="mt-6 space-y-4"> |
11 | | - <div className="bg-gray-100 p-4 rounded-lg"> |
12 | | - <h2 className="text-xl font-semibold">What is SugarLabs?</h2> |
13 | | - <p className="mt-2 text-gray-700"> |
14 | | - SugarLabs is a non-profit organization that develops free and |
15 | | - open-source educational software for children. |
16 | | - </p> |
17 | | - </div> |
18 | | - <div className="bg-gray-100 p-4 rounded-lg"> |
19 | | - <h2 className="text-xl font-semibold">How can I get involved?</h2> |
20 | | - <p className="mt-2 text-gray-700"> |
21 | | - You can join our community as a developer, volunteer, or donor. |
22 | | - Visit the "Join Development" or "Volunteer" pages for more |
23 | | - information. |
24 | | - </p> |
| 18 | + {/* Top FAQs Section */} |
| 19 | + <section className="my-8 flex justify-center"> |
| 20 | + <div className="max-w-4xl w-4/5 flex flex-col md:flex-row justify-between items-center"> |
| 21 | + {/* Left Side - Text */} |
| 22 | + <div className="md:w-1/2 text-left md:pr-8"> |
| 23 | + <h1 className="text-4xl font-bold">FAQs</h1> |
| 24 | + <p className="text-gray-600 mt-2 text-lg"> |
| 25 | + Have questions? Here you’ll find the answers most valued by our |
| 26 | + partners, along with access to step-by-step instructions and |
| 27 | + support. |
| 28 | + </p> |
| 29 | + </div> |
| 30 | + |
| 31 | + {/* Right Side - Enlarged Image */} |
| 32 | + <div className="md:w-1/2 flex justify-end"> |
| 33 | + <img |
| 34 | + src={stats.faq} |
| 35 | + alt="FAQs Illustration" |
| 36 | + className="w-80 md:w-[400px] lg:w-[500px]" |
| 37 | + /> |
| 38 | + </div> |
25 | 39 | </div> |
| 40 | + </section> |
| 41 | + |
| 42 | + {/* FAQ Sections Container */} |
| 43 | + <div className="w-4/5 max-w-5xl mx-auto"> |
| 44 | + {/* Quick Answers */} |
| 45 | + <section className="my-10"> |
| 46 | + <h2 className="text-3xl font-bold mb-6">Quick Answers</h2> |
| 47 | + <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mt-6"> |
| 48 | + {Array(6) |
| 49 | + .fill(0) |
| 50 | + .map((_, index) => ( |
| 51 | + <div |
| 52 | + key={index} |
| 53 | + className="bg-white shadow-lg rounded-2xl p-6 flex flex-col items-center border border-gray-200" |
| 54 | + > |
| 55 | + <div className="w-12 h-12 bg-gray-100 flex items-center justify-center rounded-lg mb-4"> |
| 56 | + <img |
| 57 | + src="/faq-icon.svg" |
| 58 | + alt="FAQ Icon" |
| 59 | + className="w-6 h-6" |
| 60 | + /> |
| 61 | + </div> |
| 62 | + <h3 className="font-semibold text-center"> |
| 63 | + Is Music Blocks Free? |
| 64 | + </h3> |
| 65 | + <p className="text-gray-600 text-sm text-center mt-2"> |
| 66 | + Yes! It is absolutely free to use, just visit the Music |
| 67 | + Blocks webpage to access it for free. |
| 68 | + </p> |
| 69 | + </div> |
| 70 | + ))} |
| 71 | + </div> |
| 72 | + </section> |
| 73 | + |
| 74 | + {/* General FAQs */} |
| 75 | + <section className="my-10"> |
| 76 | + <h2 className="text-3xl font-bold mb-6">General FAQs</h2> |
| 77 | + <div className="bg-white shadow-lg rounded-lg p-6"> |
| 78 | + {faqs.map((faq, index) => ( |
| 79 | + <div key={index} className="border-b"> |
| 80 | + <button |
| 81 | + className="w-full text-left py-4 text-lg font-medium flex justify-between items-center" |
| 82 | + onClick={() => toggleFAQ(index)} |
| 83 | + > |
| 84 | + {faq.question} |
| 85 | + <span>{openIndex === index ? '-' : '+'}</span> |
| 86 | + </button> |
| 87 | + {openIndex === index && ( |
| 88 | + <p className="p-4 text-gray-700">{faq.answer}</p> |
| 89 | + )} |
| 90 | + </div> |
| 91 | + ))} |
| 92 | + </div> |
| 93 | + </section> |
26 | 94 | </div> |
27 | 95 | </main> |
28 | 96 | <Footer /> |
|
0 commit comments