Explorar o código

organize styles

yohei0125 %!s(int64=4) %!d(string=hai) anos
pai
achega
d4a0d57a0f
Modificáronse 1 ficheiros con 5 adicións e 4 borrados
  1. 5 4
      packages/app/src/components/Page/PageListItem.tsx

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

@@ -63,13 +63,14 @@ const PageListItem: FC<Props> = memo((props:Props) => {
   }, [isDeviceSmallerThanLg, onClickSearchResultItem, pageData._id]);
   }, [isDeviceSmallerThanLg, onClickSearchResultItem, pageData._id]);
 
 
   // background color of list item changes when class "active" exists under 'grw-search-result-item'
   // background color of list item changes when class "active" exists under 'grw-search-result-item'
-  const responsiveListStyleClass = `${isDeviceSmallerThanLg ? '' : `${isSelected ? 'active' : ''}`}`;
+  const styleListGroupItem = (!isDeviceSmallerThanLg && onClickCheckbox != null) ? 'list-group-item-action' : '';
+  const styleActive = !isDeviceSmallerThanLg && isSelected ? 'active' : '';
+  const styleBorder = onClickCheckbox != null ? 'border-bottom' : 'list-group-item p-0';
+
   return (
   return (
     <li
     <li
       key={pageData._id}
       key={pageData._id}
-      className={`w-100 grw-search-result-item search-result-list
-        ${onClickCheckbox != null ? 'list-group-item-action border-bottom' : 'list-group-item p-0'}
-        ${responsiveListStyleClass}`
+      className={`w-100 grw-search-result-item search-result-list ${styleListGroupItem} ${styleActive} ${styleBorder}}`
       }
       }
     >
     >
       <div
       <div