diff --git a/components/layout/footer-menu.tsx b/components/layout/footer-menu.tsx index 2354f456c..444406294 100644 --- a/components/layout/footer-menu.tsx +++ b/components/layout/footer-menu.tsx @@ -2,7 +2,6 @@ import clsx from 'clsx'; import { Menu } from 'lib/shopify/types'; -import { RemoveTheDomainFromUrl } from 'lib/utils'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { useEffect, useState } from 'react'; @@ -18,7 +17,7 @@ const FooterMenuItem = ({ item }: { item: Menu }) => { return (
  • 2023 ? `-${currentYear}` : ''); const skeleton = 'w-full h-6 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700'; const menu = await getMenu('next-js-frontend-footer-menu'); + const updatedMenuLinks = RemoveTheDomainFromArray(menu); const copyrightName = COMPANY_NAME || SITE_NAME || ''; return ( @@ -35,7 +37,7 @@ export default async function Footer() { } > - +
    { return modifiedUrl; }; +export const RemoveTheDomainFromArray = (menu: any) => { + const lowercaseString = `https://${SHOPIFY_STORE_DOMAIN}`.toLowerCase(); + + const modifiedUrls = menu.map((item: any) => { + const modifiedPath = item.path.replace(lowercaseString, ''); + return { ...item, path: modifiedPath }; + }); + + return modifiedUrls; +}; + export const ensureStartsWith = (stringToCheck: string, startsWith: string) => stringToCheck.startsWith(startsWith) ? stringToCheck : `${startsWith}${stringToCheck}`;