Przeglądaj źródła

make small changes

yuto-oweseek 4 lat temu
rodzic
commit
d2c594067f

+ 4 - 6
packages/app/src/components/SearchPage/SearchResultList.tsx

@@ -2,7 +2,7 @@ import React, { FC } from 'react';
 import PropTypes from 'prop-types';
 import PropTypes from 'prop-types';
 import SearchResultListItem from './SearchResultListItem';
 import SearchResultListItem from './SearchResultListItem';
 
 
-export interface page {
+export type Page = {
   _id: string;
   _id: string;
   snippet: string;
   snippet: string;
   path: string;
   path: string;
@@ -11,12 +11,11 @@ export interface page {
   lastUpdateUser: any;
   lastUpdateUser: any;
 }
 }
 
 
-type Props ={
-  pages: page[],
+type Props = {
+  pages: Page[],
   deletionMode: boolean,
   deletionMode: boolean,
-  selectedPages: page[],
+  selectedPages: Page[],
   onClickInvoked?: (pageId: string) => void,
   onClickInvoked?: (pageId: string) => void,
-  onChangeInvoked?: (page: {any}) => void,
 }
 }
 
 
 const SearchResultList: FC<Props> = (props:Props) => {
 const SearchResultList: FC<Props> = (props:Props) => {
@@ -42,7 +41,6 @@ SearchResultList.propTypes = {
   deletionMode: PropTypes.bool.isRequired,
   deletionMode: PropTypes.bool.isRequired,
   selectedPages: PropTypes.array.isRequired,
   selectedPages: PropTypes.array.isRequired,
   onClickInvoked: PropTypes.func,
   onClickInvoked: PropTypes.func,
-  onChangeInvoked: PropTypes.func,
 };
 };
 
 
 export default SearchResultList;
 export default SearchResultList;

+ 17 - 11
packages/app/src/components/SearchPage/SearchResultListItem.tsx

@@ -2,19 +2,18 @@ import React, { FC, useMemo } from 'react';
 
 
 import { UserPicture, PageListMeta, PagePathLabel } from '@growi/ui';
 import { UserPicture, PageListMeta, PagePathLabel } from '@growi/ui';
 import { DevidedPagePath } from '@growi/core';
 import { DevidedPagePath } from '@growi/core';
-import { page } from './SearchResultList';
+import { Page } from './SearchResultList';
 
 
 import loggerFactory from '~/utils/logger';
 import loggerFactory from '~/utils/logger';
 
 
 const logger = loggerFactory('growi:searchResultList');
 const logger = loggerFactory('growi:searchResultList');
 
 
 type Props ={
 type Props ={
-  page: page,
-  onClickInvoked: (data: string) => void,
+  page: Page,
+  onClickInvoked?: (data: string) => void,
 }
 }
 
 
 const SearchResultListItem: FC<Props> = (props:Props) => {
 const SearchResultListItem: FC<Props> = (props:Props) => {
-
   const { page, onClickInvoked } = props;
   const { page, onClickInvoked } = props;
 
 
   // Add prefix 'id_' in pageId, because scrollspy of bootstrap doesn't work when the first letter of id attr of target component is numeral.
   // Add prefix 'id_' in pageId, because scrollspy of bootstrap doesn't work when the first letter of id attr of target component is numeral.
@@ -34,7 +33,7 @@ const SearchResultListItem: FC<Props> = (props:Props) => {
           <i className="fa fa-ellipsis-v text-muted"></i>
           <i className="fa fa-ellipsis-v text-muted"></i>
         </button>
         </button>
         <div className="dropdown-menu dropdown-menu-right">
         <div className="dropdown-menu dropdown-menu-right">
-          {/* TODO: if there is the following button in XD please add it here
+          {/* TODO: if there is the following button in XD add it here
           <button
           <button
             type="button"
             type="button"
             className="btn btn-link p-0"
             className="btn btn-link p-0"
@@ -46,14 +45,18 @@ const SearchResultListItem: FC<Props> = (props:Props) => {
             <i className="icon-login" />
             <i className="icon-login" />
           </button>
           </button>
           */}
           */}
-          <button className="dropdown-item" type="button" onClick={() => console.log(pageId, revisionId, pagePath)}>
-            <i className="icon-fw  icon-action-redo"></i>Move/Rename
+          {/* TODO: add function to the following buttons */}
+          <button className="dropdown-item text-danger" type="button" onClick={() => console.log('delete modal show')}>
+            <i className="icon-fw icon-fire"></i>Delete
+          </button>
+          <button className="dropdown-item" type="button" onClick={() => console.log('duplicate modal show')}>
+            <i className="icon-fw icon-docs"></i>add to bookmarks
           </button>
           </button>
-          <button className="dropdown-item" type="button">
+          <button className="dropdown-item" type="button" onClick={() => console.log('duplicate modal show')}>
             <i className="icon-fw icon-docs"></i>Duplicate
             <i className="icon-fw icon-docs"></i>Duplicate
           </button>
           </button>
-          <button className="dropdown-item text-danger" type="button">
-            <i className="icon-fw icon-fire"></i>Delete
+          <button className="dropdown-item" type="button" onClick={() => console.log('rename function will be added')}>
+            <i className="icon-fw  icon-action-redo"></i>Move/Rename
           </button>
           </button>
         </div>
         </div>
       </>
       </>
@@ -110,10 +113,13 @@ const SearchResultListItem: FC<Props> = (props:Props) => {
     );
     );
   }, []);
   }, []);
 
 
+  const pageList: JSX.Element = renderPage;
+
   return (
   return (
     <>
     <>
-      {renderPage}
+      {pageList}
     </>
     </>
   );
   );
 };
 };
+
 export default SearchResultListItem;
 export default SearchResultListItem;