import React from 'react'; import { useTranslation } from 'next-i18next'; import { useCurrentPagePath } from '~/stores/page'; type MenuItemProps = { children: React.ReactNode onClick: () => void } const MenuItem = (props: MenuItemProps): JSX.Element => { const { children, onClick } = props; return (
search { children }
); }; type SearchMethodMenuItemProps = { searchKeyword: string } export const SearchMethodMenuItem = (props: SearchMethodMenuItemProps): JSX.Element => { const { t } = useTranslation('commons'); const { data: currentPagePath } = useCurrentPagePath(); const { searchKeyword } = props; const shouldShowButton = searchKeyword.length > 0; return ( { shouldShowButton && ( {}}> {searchKeyword}
{t('search_buttons.search_in_all')}
)} {}}> prefix: {currentPagePath} {searchKeyword}
{t('search_buttons.only_children_of_this_tree')}
{ shouldShowButton && ( {}}> {`"${searchKeyword}"`}
{t('search_buttons.exact_mutch')}
) }
); };