소스 검색

Hide sections when there is only one to display

Loris Leiva 2 년 전
부모
커밋
8b695becde
2개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 2
      src/components/Header.jsx
  2. 1 1
      src/components/MobileNavigation.jsx

+ 2 - 2
src/components/Header.jsx

@@ -77,10 +77,10 @@ export function Header({ page }) {
           </Link>
           </Link>
         </div>
         </div>
       </div>
       </div>
-      {page.product?.sections && (
+      {page.product.sections && page.product.sections.length > 1 && (
         <Sections
         <Sections
           className="hidden gap-6 px-2 py-2 text-sm sm:px-4 lg:flex lg:px-6"
           className="hidden gap-6 px-2 py-2 text-sm sm:px-4 lg:flex lg:px-6"
-          sections={page.product?.sections}
+          sections={page.product.sections}
           activeSectionId={page.activeSection?.id}
           activeSectionId={page.activeSection?.id}
         />
         />
       )}
       )}

+ 1 - 1
src/components/MobileNavigation.jsx

@@ -86,7 +86,7 @@ export function MobileNavigation({ page }) {
               <LogoWithName product={page.product} />
               <LogoWithName product={page.product} />
             </Link>
             </Link>
           </div>
           </div>
-          {page.product.sections && (
+          {page.product.sections && page.product.sections.length > 1 && (
             <Sections
             <Sections
               className="-ml-2 mt-12 flex flex-col gap-2"
               className="-ml-2 mt-12 flex flex-col gap-2"
               sections={page.product.sections}
               sections={page.product.sections}