Kaynağa Gözat

Hide sections when there is only one to display

Loris Leiva 2 yıl önce
ebeveyn
işleme
8b695becde

+ 2 - 2
src/components/Header.jsx

@@ -77,10 +77,10 @@ export function Header({ page }) {
           </Link>
         </div>
       </div>
-      {page.product?.sections && (
+      {page.product.sections && page.product.sections.length > 1 && (
         <Sections
           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}
         />
       )}

+ 1 - 1
src/components/MobileNavigation.jsx

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