diff --git a/next/app/feedback/page.tsx b/next/app/feedback/page.tsx index 642c415..19cdabf 100644 --- a/next/app/feedback/page.tsx +++ b/next/app/feedback/page.tsx @@ -1,22 +1,21 @@ -import FeedbackForm from "@/components/feedback/FeedbackForm"; +import ActiveSection from "@/components/feedback/ActiveSection"; import Header from "@/components/header/header"; import { feedbackPageSchema } from "@/schemas/single/FeedbackPage"; import fetchStrapi from "@/util/strapi"; -import { IoChevronDown } from "react-icons/io5"; export default async function Feedback() { const data = await fetchStrapi("faq-page", feedbackPageSchema); const QAs = data.QuestionAnswer; return ( -
+
{/* @ts-ignore */}
-
-
-

FAQ

-

& Contact

-
-
-

- Frequently Asked Questions -

-
- {QAs.map((QA) => { - return ( -
-
{QA.Answer}
- -

{QA.Question}

- -
-
- ); - })} -
-

Contact Form

- -
-
+
); } diff --git a/next/assets/feedback/selectionArrow.png b/next/assets/feedback/selectionArrow.png new file mode 100644 index 0000000..4f919bf Binary files /dev/null and b/next/assets/feedback/selectionArrow.png differ diff --git a/next/components/feedback/ActiveSection.tsx b/next/components/feedback/ActiveSection.tsx index 2a66e20..e7929c5 100644 --- a/next/components/feedback/ActiveSection.tsx +++ b/next/components/feedback/ActiveSection.tsx @@ -1,6 +1,9 @@ "use client"; +import selectionArrow from "@/assets/feedback/selectionArrow.png"; +import Image from "next/image"; import { useState } from "react"; -import { IoChevronDown } from "react-icons/io5"; +import FAQ from "./FAQ"; +import FeedbackForm from "./FeedbackForm"; export default function ActiveSection({ data, @@ -13,33 +16,52 @@ export default function ActiveSection({ }; }) { const QAs = data.QuestionAnswer; + const [styleClick, setStyleClick] = useState(); const [activeSection, setActiveSection] = useState<"FAQ" | "Contact">("FAQ"); + function handleClick() { + setStyleClick(true); + + setTimeout(() => { + if (activeSection == "Contact") { + setActiveSection("FAQ"); + } else { + setActiveSection("Contact"); + } + setStyleClick(false); + }, 300); + } + return ( -
-
- - -
-
-

Frequently Asked Questions

-
- {QAs.map((QA) => { - return ( -
-
{QA.Answer}
- -

{QA.Question}

- -
-
- ); - })} +
+
+
+ +
+ Selection arrow + +
+
+ {activeSection == "FAQ" ? : } +
); } diff --git a/next/components/feedback/FAQ.tsx b/next/components/feedback/FAQ.tsx new file mode 100644 index 0000000..92586d2 --- /dev/null +++ b/next/components/feedback/FAQ.tsx @@ -0,0 +1,30 @@ +import { IoChevronDown } from "react-icons/io5"; + +export default function FAQ({ + QAs, +}: { + QAs: { Question: string; Answer: string }[]; +}) { + return ( +
+

Frequently Asked Questions

+
+ {QAs.map((QA) => { + return ( +
+
{QA.Answer}
+ +

{QA.Question}

+ +
+
+ ); + })} +
+
+ ); + +} diff --git a/next/components/feedback/FeedbackForm.tsx b/next/components/feedback/FeedbackForm.tsx index 7aec3fd..5c3bace 100644 --- a/next/components/feedback/FeedbackForm.tsx +++ b/next/components/feedback/FeedbackForm.tsx @@ -1,6 +1,6 @@ export default function FeedbackForm() { async function handleSubmit(data: FormData) { - "use server"; + "use client"; const name = data.get("name"); const email = data.get("email"); const message = data.get("message"); @@ -13,36 +13,38 @@ export default function FeedbackForm() { } return ( -
- - - - - - + <> + + + + + + + +
- + ); } diff --git a/next/tailwind.config.js b/next/tailwind.config.js index 337ef8b..fee0c53 100644 --- a/next/tailwind.config.js +++ b/next/tailwind.config.js @@ -19,6 +19,16 @@ module.exports = { "b-orange": "#FAAB36", "b-light-orange": "#FABD6E", }, + keyframes: { + fadeIn: { + "0%": { opacity: 0 }, + "100%": { opacity: 1 }, + }, + fadeOut: { + "0%": { opacity: 1 }, + "100%": { opacity: 0 }, + }, + }, }, }, plugins: [],