From 87bb37efa640066dab1cfd6461d5c0dd1607e5c6 Mon Sep 17 00:00:00 2001 From: Michael Novotny Date: Mon, 10 Jul 2023 12:57:10 -0500 Subject: [PATCH] Redesigns footer (#1065) --- components/icons/logo.tsx | 9 +-- components/icons/vercel.tsx | 20 ------- components/layout/footer-menu.tsx | 43 +++++++++++++++ components/layout/footer.tsx | 92 +++++++++++++++---------------- components/logo-square.tsx | 18 ++++++ 5 files changed, 111 insertions(+), 71 deletions(-) delete mode 100644 components/icons/vercel.tsx create mode 100644 components/layout/footer-menu.tsx create mode 100644 components/logo-square.tsx diff --git a/components/icons/logo.tsx b/components/icons/logo.tsx index cdcfc8fe2..7b7028062 100644 --- a/components/icons/logo.tsx +++ b/components/icons/logo.tsx @@ -1,3 +1,5 @@ +import clsx from 'clsx'; + export default function LogoIcon({ className }: { className?: string }) { return ( - ); diff --git a/components/icons/vercel.tsx b/components/icons/vercel.tsx deleted file mode 100644 index 06e4d62da..000000000 --- a/components/icons/vercel.tsx +++ /dev/null @@ -1,20 +0,0 @@ -export default function VercelIcon({ className }: { className?: string }) { - return ( - - - - - - - - - - ); -} diff --git a/components/layout/footer-menu.tsx b/components/layout/footer-menu.tsx new file mode 100644 index 000000000..caf579bd5 --- /dev/null +++ b/components/layout/footer-menu.tsx @@ -0,0 +1,43 @@ +'use client'; + +import clsx from 'clsx'; +import { Menu } from 'lib/shopify/types'; +import Link from 'next/link'; +import { usePathname } from 'next/navigation'; +import { useEffect, useState } from 'react'; + +const FooterMenuItem = ({ item }: { item: Menu }) => { + const pathname = usePathname(); + const [active, setActive] = useState(pathname === item.path); + + useEffect(() => { + setActive(pathname === item.path); + }, [pathname, item.path]); + + return ( +
  • + + {item.title} + +
  • + ); +}; + +export default async function FooterMenu({ menu }: { menu: Menu[] }) { + if (!menu.length) return null; + + return ( + + ); +} diff --git a/components/layout/footer.tsx b/components/layout/footer.tsx index 72e9e03fc..01d0d01ca 100644 --- a/components/layout/footer.tsx +++ b/components/layout/footer.tsx @@ -1,68 +1,66 @@ import Link from 'next/link'; import GitHubIcon from 'components/icons/github'; -import LogoIcon from 'components/icons/logo'; -import VercelIcon from 'components/icons/vercel'; +import FooterMenu from 'components/layout/footer-menu'; +import LogoSquare from 'components/logo-square'; import { getMenu } from 'lib/shopify'; -import { Menu } from 'lib/shopify/types'; +import { Suspense } from 'react'; const { SITE_NAME } = process.env; export default async function Footer() { const currentYear = new Date().getFullYear(); const copyrightDate = 2023 + (currentYear > 2023 ? `-${currentYear}` : ''); + const skeleton = 'w-full h-6 animate-pulse rounded bg-gray-200 dark:bg-gray-700'; const menu = await getMenu('next-js-frontend-footer-menu'); return ( -