From 1475a0ecf8813d7b6c017d58cb648901b458c334 Mon Sep 17 00:00:00 2001 From: haseebzaki-07 Date: Fri, 25 Oct 2024 23:07:28 +0530 Subject: [PATCH] Fix forum page --- src/app/(pages)/FAQsForum/page.jsx | 151 ++++++++++++++++++----------- 1 file changed, 97 insertions(+), 54 deletions(-) diff --git a/src/app/(pages)/FAQsForum/page.jsx b/src/app/(pages)/FAQsForum/page.jsx index d900ea8..b75bd36 100644 --- a/src/app/(pages)/FAQsForum/page.jsx +++ b/src/app/(pages)/FAQsForum/page.jsx @@ -2,7 +2,7 @@ import { useState } from "react"; import { FAQs } from "./FAQs"; import { posts as initialPosts } from "./Posts"; -import "./Posts.css" +import "./Posts.css"; const FAQForum = () => { const [activeIndex, setActiveIndex] = useState(null); @@ -13,7 +13,12 @@ const FAQForum = () => { setActiveIndex(activeIndex === index ? null : index); }; - const cardColors = ["bg-red-500", "bg-blue-500", "bg-green-500", "bg-yellow-500"]; + const cardColors = [ + "bg-red-500", + "bg-blue-500", + "bg-green-500", + "bg-yellow-500", + ]; const handleSubmit = (e) => { e.preventDefault(); @@ -26,9 +31,11 @@ const FAQForum = () => { const [sortAsc, setSortAsc] = useState(true); const toggleExpand = (id) => { - setExpandedPosts(expandedPosts.includes(id) - ? expandedPosts.filter((postId) => postId !== id) - : [...expandedPosts, id]); + setExpandedPosts( + expandedPosts.includes(id) + ? expandedPosts.filter((postId) => postId !== id) + : [...expandedPosts, id] + ); }; const handleSort = () => { @@ -50,31 +57,39 @@ const FAQForum = () => { {/* FAQs Section */}
-

Frequently Asked Questions

+

+ Frequently Asked Questions +

{FAQs.map((faq, index) => (
{faq.answer} @@ -87,7 +102,9 @@ const FAQForum = () => { {/* Forum Section */}
-

Forum

+

+ Forum +

@@ -96,14 +113,18 @@ const FAQForum = () => { className="p-4 w-full border border-indigo-300 rounded-lg shadow-sm focus:outline-none focus:border-indigo-500 focus:ring-2 focus:ring-indigo-400 transition duration-300" placeholder="Post title" value={newPost.title} - onChange={(e) => setNewPost({ ...newPost, title: e.target.value })} + onChange={(e) => + setNewPost({ ...newPost, title: e.target.value }) + } required />