import React from 'react';
import { useTranslation } from 'next-i18next';
import { useCurrentPagePath } from '~/stores/page';
import type { GetItemProps } from '../interfaces/downshift';
import { SearchMenuItem } from './SearchMenuItem';
type Props = {
activeIndex: number | null
searchKeyword: string
getItemProps: GetItemProps
}
export const SearchMethodMenuItem = (props: Props): JSX.Element => {
const {
activeIndex, searchKeyword, getItemProps,
} = props;
const { t } = useTranslation('commons');
const { data: currentPagePath } = useCurrentPagePath();
const shouldShowMenuItem = searchKeyword.trim().length > 0;
return (
<>
{ shouldShowMenuItem && (
search
{searchKeyword}
{t('search_method_menu_item.search_in_all')}
)}
search
prefix: {currentPagePath}
{searchKeyword}
{t('search_method_menu_item.only_children_of_this_tree')}
{ shouldShowMenuItem && (
search
{`"${searchKeyword}"`}
{t('search_method_menu_item.exact_mutch')}
) }
>
);
};