'use client'; import { Accordion, LoaderSpinner, TabPanel, Tabs } from '@theme/components'; import React from 'react'; import { useGetWidgetQuery } from '@akinon/next/data/client/misc'; import { useLocalization } from '@akinon/next/hooks'; interface Props { searchKey?: string; } export function FaqTabs(props: Props) { const { searchKey } = props; const { data, isLoading } = useGetWidgetQuery('faq'); const { locale } = useLocalization(); if (isLoading) { return ; } return (
{data?.attributes?.faq_categories?.map((item, index) => (
{item.value.category}
{data?.attributes?.faq_contents ?.filter( (faq) => faq.value.content .toLocaleLowerCase(locale) .includes(searchKey) || faq.value.title .toLocaleLowerCase(locale) .includes(searchKey) ) .map((faq, index) => { if (faq.value.category == item.value.category_id) { return (
); } })}
))}
); }