From 8ffe6a72cd2ce15a7b081c2c57aaef0d9bdb2037 Mon Sep 17 00:00:00 2001
From: akash
Date: Sat, 14 Feb 2026 12:47:47 +0530
Subject: [PATCH] faq 1st one always open updated
---
.../about-antalya-restaurant/AboutContent.tsx | 35 ++++++++++++++++---
src/components/FAQ/FAQ.tsx | 13 +++++--
2 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/src/app/about-antalya-restaurant/AboutContent.tsx b/src/app/about-antalya-restaurant/AboutContent.tsx
index 17e5cf0..df8408e 100644
--- a/src/app/about-antalya-restaurant/AboutContent.tsx
+++ b/src/app/about-antalya-restaurant/AboutContent.tsx
@@ -38,6 +38,17 @@ export default function AboutContent() {
const [loading, setLoading] = useState(true);
const [expandedReview, setExpandedReview] = useState(null);
const [swiperInstance, setSwiperInstance] = useState(null);
+ const [openFaqIndex, setOpenFaqIndex] = useState(0);
+
+ // Ensure first FAQ is open on mount with a small delay
+ useEffect(() => {
+ if (aboutFaqData.length > 0) {
+ const timer = setTimeout(() => {
+ setOpenFaqIndex(0);
+ }, 100);
+ return () => clearTimeout(timer);
+ }
+ }, []);
// Auto-collapse expanded review after 10 seconds and handle autoplay
useEffect(() => {
@@ -429,7 +440,13 @@ export default function AboutContent() {
{aboutFaqData.map((faq, index) => (
-
+ setOpenFaqIndex(openFaqIndex === index ? null : index)}
+ />
))}
@@ -488,14 +505,22 @@ export default function AboutContent() {
}
// FAQ Item Component
-function FaqItem({ question, answer }: { question: string; answer: string }) {
- const [isOpen, setIsOpen] = useState(false);
-
+function FaqItem({
+ question,
+ answer,
+ isOpen,
+ onToggle
+}: {
+ question: string;
+ answer: string;
+ isOpen: boolean;
+ onToggle: () => void;
+}) {
return (