Browse Source

SearchButtons -> SearchMethodMenuItem

Shun Miyazawa 2 năm trước cách đây
mục cha
commit
99dce90e71

+ 10 - 10
apps/app/src/features/search/client/components/SearchButtons.tsx → apps/app/src/features/search/client/components/SearchMethodMenuItem.tsx

@@ -4,11 +4,11 @@ import { useTranslation } from 'next-i18next';
 
 import { useCurrentPagePath } from '~/stores/page';
 
-type SearchButtonProps = {
+type MenuItemProps = {
   children: React.ReactNode
   onClick: () => void
 }
-const SearchButton = (props: SearchButtonProps): JSX.Element => {
+const MenuItem = (props: MenuItemProps): JSX.Element => {
   const { children, onClick } = props;
 
   return (
@@ -22,10 +22,10 @@ const SearchButton = (props: SearchButtonProps): JSX.Element => {
 };
 
 
-type SearchButtonsProps = {
+type SearchMethodMenuItemProps = {
   searchKeyword: string
 }
-export const SearchButtons = (props: SearchButtonsProps): JSX.Element => {
+export const SearchMethodMenuItem = (props: SearchMethodMenuItemProps): JSX.Element => {
   const { t } = useTranslation('commons');
 
   const { data: currentPagePath } = useCurrentPagePath();
@@ -38,29 +38,29 @@ export const SearchButtons = (props: SearchButtonsProps): JSX.Element => {
     <table className="table">
       <tbody>
         { shouldShowButton && (
-          <SearchButton onClick={() => {}}>
+          <MenuItem onClick={() => {}}>
             <span>{searchKeyword}</span>
             <div className="ms-auto">
               <span>{t('search_buttons.search_in_all')}</span>
             </div>
-          </SearchButton>
+          </MenuItem>
         )}
 
-        <SearchButton onClick={() => {}}>
+        <MenuItem onClick={() => {}}>
           <code>prefix: {currentPagePath}</code>
           <span className="ms-2">{searchKeyword}</span>
           <div className="ms-auto">
             <span>{t('search_buttons.only_children_of_this_tree')}</span>
           </div>
-        </SearchButton>
+        </MenuItem>
 
         { shouldShowButton && (
-          <SearchButton onClick={() => {}}>
+          <MenuItem onClick={() => {}}>
             <span>{`"${searchKeyword}"`}</span>
             <div className="ms-auto">
               <span>{t('search_buttons.exact_mutch')}</span>
             </div>
-          </SearchButton>
+          </MenuItem>
         ) }
       </tbody>
     </table>

+ 2 - 2
apps/app/src/features/search/client/components/SearchModal.tsx

@@ -6,9 +6,9 @@ import { Modal, ModalBody } from 'reactstrap';
 
 import { useSearchModal } from '../stores/search';
 
-import { SearchButtons } from './SearchButtons';
 import { SearchForm } from './SearchForm';
 import { SearchHelp } from './SearchHelp';
+import { SearchMethodMenuItem } from './SearchMethodMenuItem';
 
 const SearchModal = (): JSX.Element => {
   const { data: searchModalData, close: closeSearchModal } = useSearchModal();
@@ -38,7 +38,7 @@ const SearchModal = (): JSX.Element => {
           onClickClearButton={clickClearButtonHandler}
         />
         <div className="border-top mt-3 mb-3" />
-        <SearchButtons searchKeyword={searchKeyword} />
+        <SearchMethodMenuItem searchKeyword={searchKeyword} />
         <div className="border-top mt-2 mb-2" />
         <SearchHelp />
       </ModalBody>