From f99e0aba70efad0deb907d8e27f09fc9f527c8a4 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 17 Feb 2023 17:07:50 +0700 Subject: Refactor --- src/pages/faqs.js | 91 ------------------------------------------------------- 1 file changed, 91 deletions(-) delete mode 100644 src/pages/faqs.js (limited to 'src/pages/faqs.js') diff --git a/src/pages/faqs.js b/src/pages/faqs.js deleted file mode 100644 index cdb8ef52..00000000 --- a/src/pages/faqs.js +++ /dev/null @@ -1,91 +0,0 @@ -import AppBar from "@/components/layouts/AppBar"; -import Layout from "@/components/layouts/Layout"; -import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/outline"; -import { useEffect, useState } from "react"; - -const dataFaqs = [ - { - id: 1, - name: 'Akun', - description: 'Bantuan tentang pengelolaan fitur dan akun' - }, - { - id: 2, - name: 'Pembelian', - description: 'Bantuan seputar status stock, layanan pengiriman & asuransi hingga seluruh indonesia' - }, - { - id: 3, - name: 'Metode Pembayaran', - description: 'Bantuan terkait layanan metode pembayaran' - }, - { - id: 4, - name: 'Quotation', - description: 'Bantuan fitur RFQ & quotation Express' - }, - { - id: 5, - name: 'Faktur Pajak & Invoice', - description: 'Bantuan seputar layanan terbit faktur pajak & invoice' - }, - { - id: 6, - name: 'Pengembalian & Garansi', - description: 'Bantuan cara pengembalian produk & garansi produk' - } -]; - -export default function Faqs() { - const [ faqs, setFaqs ] = useState([]); - - useEffect(() => { - if (faqs.length == 0) { - setFaqs(dataFaqs.map((dataFaq) => ({ - ...dataFaq, - isOpen: false - }))); - } - }, [ faqs ]); - - const toggleFaq = (id) => { - const faqsToUpdate = faqs.map(faq => { - if (faq.id == id) faq.isOpen = !faq.isOpen; - return faq; - }); - setFaqs(faqsToUpdate); - }; - - return ( - - - -
- { faqs.map((faq, index) => ( -
-
-
-

{ faq.name }

-

- { faq.description } -

-
- -
- { faq.isOpen && ( -

- { faq?.content || 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.' } -

- ) } -
- )) } -
-
- ) -} \ No newline at end of file -- cgit v1.2.3