diff --git a/prisma/migrations/20240915130106_/migration.sql b/prisma/migrations/20240915130106_/migration.sql new file mode 100644 index 00000000..0e7f2dbe --- /dev/null +++ b/prisma/migrations/20240915130106_/migration.sql @@ -0,0 +1,15 @@ +/* + Warnings: + + - You are about to drop the column `location` on the `Job` table. All the data in the column will be lost. + - Added the required column `address` to the `Job` table without a default value. This is not possible if the table is not empty. + - Added the required column `city` to the `Job` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "Job" DROP COLUMN "location", +ADD COLUMN "address" TEXT NOT NULL, +ADD COLUMN "city" TEXT NOT NULL; + +-- DropEnum +DROP TYPE "JobLocations"; diff --git a/src/components/Faqs.tsx b/src/components/Faqs.tsx index 6d83850a..c31641c8 100644 --- a/src/components/Faqs.tsx +++ b/src/components/Faqs.tsx @@ -1,35 +1,17 @@ 'use client'; import { faqData } from '@/lib/constant/faqs.constants'; import { ChevronDown } from 'lucide-react'; -import { useEffect, useRef, useState } from 'react'; +import { useState } from 'react'; +import { motion, AnimatePresence } from 'framer-motion'; import FaqsGetintouchCard from './FaqsGetintouchCard'; export default function Faqs() { const [expandedIndex, setExpandedIndex] = useState(null); - const expandRef = useRef<(HTMLDivElement | null)[]>([]); - - const toggleExpand = (index: number | null) => { + const toggleExpand = (index: number) => { setExpandedIndex(index === expandedIndex ? null : index); }; - const handleClickOutside = (event: MouseEvent) => { - if ( - expandedIndex !== null && - expandRef.current[expandedIndex] && - !expandRef.current[expandedIndex].contains(event.target as Node) - ) { - setExpandedIndex(null); - } - }; - - useEffect(() => { - document.addEventListener('mousedown', handleClickOutside); - return () => { - document.removeEventListener('mousedown', handleClickOutside); - }; - }, [expandedIndex]); - return (

FAQs

-

- Quick answers to any questions you may have.{' '} +

+ Quick answers to any questions you may have.

-
+
{faqData.map((faq, i) => (
{ - expandRef.current[i] = el; - }} - className={`w-full flex h-fit flex-col items-start md:p-6 p-4 ${i !== faqData.length - 1 && 'border-b'}`} + className={`w-full flex flex-col items-start md:p-6 p-4 ${ + i !== faqData.length - 1 && 'border-b' + }`} > -
toggleExpand(i)} + aria-expanded={expandedIndex === i} > -
-

- {faq.question} -

- -
-
- -

- {faq.answer} -

+

+ {faq.question} +

+ + + + + + {expandedIndex === i && ( + +

+ {faq.answer} +

+
+ )} +
))}