Просмотр исходного кода

remove props and small refactor

yohei0125 4 лет назад
Родитель
Сommit
dcf1f1e4b3

+ 4 - 9
packages/app/src/components/Page/PageListItem.tsx

@@ -17,8 +17,7 @@ type Props = {
   isChecked: boolean, // is checkbox of item checked
   isChecked: boolean, // is checkbox of item checked
   isEnableActions: boolean,
   isEnableActions: boolean,
   shortBody?: string
   shortBody?: string
-  showCheckbox: boolean,
-  showPageUpdatedTime: boolean, // whether to show page's updated time at the top-right corner of item
+  showPageUpdatedTime?: boolean, // whether to show page's updated time at the top-right corner of item
   onClickCheckbox?: (pageId: string) => void,
   onClickCheckbox?: (pageId: string) => void,
   onClickSearchResultItem?: (pageId: string) => void,
   onClickSearchResultItem?: (pageId: string) => void,
   onClickDeleteButton?: (pageId: string) => void,
   onClickDeleteButton?: (pageId: string) => void,
@@ -28,7 +27,7 @@ const PageListItem: FC<Props> = memo((props:Props) => {
   const {
   const {
     // todo: refactoring variable name to clear what changed
     // todo: refactoring variable name to clear what changed
     page: { pageData, pageMeta }, isSelected, onClickSearchResultItem, onClickCheckbox, isChecked, isEnableActions, shortBody,
     page: { pageData, pageMeta }, isSelected, onClickSearchResultItem, onClickCheckbox, isChecked, isEnableActions, shortBody,
-    showCheckbox, showPageUpdatedTime,
+    showPageUpdatedTime,
   } = props;
   } = props;
 
 
   const { data: isDeviceSmallerThanLg } = useIsDeviceSmallerThanLg();
   const { data: isDeviceSmallerThanLg } = useIsDeviceSmallerThanLg();
@@ -76,17 +75,13 @@ const PageListItem: FC<Props> = memo((props:Props) => {
       >
       >
         <div className="d-flex h-100">
         <div className="d-flex h-100">
           {/* checkbox */}
           {/* checkbox */}
-          {showCheckbox && (
+          {onClickCheckbox != null && (
             <div className="form-check d-flex align-items-center justify-content-center px-md-2 pl-3 pr-2 search-item-checkbox">
             <div className="form-check d-flex align-items-center justify-content-center px-md-2 pl-3 pr-2 search-item-checkbox">
               <input
               <input
                 className="form-check-input position-relative m-0"
                 className="form-check-input position-relative m-0"
                 type="checkbox"
                 type="checkbox"
                 id="flexCheckDefault"
                 id="flexCheckDefault"
-                onChange={() => {
-                  if (onClickCheckbox != null) {
-                    onClickCheckbox(pageData._id);
-                  }
-                }}
+                onChange={() => { onClickCheckbox(pageData._id) }}
                 checked={isChecked}
                 checked={isChecked}
               />
               />
             </div>
             </div>

+ 0 - 2
packages/app/src/components/SearchPage/SearchResultList.tsx

@@ -42,8 +42,6 @@ const SearchResultList: FC<Props> = (props:Props) => {
             isChecked={isChecked}
             isChecked={isChecked}
             isSelected={page.pageData._id === focusedPageId || false}
             isSelected={page.pageData._id === focusedPageId || false}
             onClickDeleteButton={props.onClickDeleteButton}
             onClickDeleteButton={props.onClickDeleteButton}
-            showCheckbox
-            showPageUpdatedTime={false}
           />
           />
         );
         );
       })}
       })}