diff --git a/src/components/layout/Footer.tsx b/src/components/layout/Footer.tsx index 6d6338d..e8460ac 100644 --- a/src/components/layout/Footer.tsx +++ b/src/components/layout/Footer.tsx @@ -1,8 +1,19 @@ /* eslint-disable @next/next/no-img-element */ +import Image from 'next/image' import Link from 'next/link' import { getGlobal } from '@/lib/payload' import type { FooterGlobal } from '@/types/globals' +function resolveLogoUrl(logo: unknown): string | null { + if (!logo) return null + if (typeof logo === 'string') return logo + if (typeof logo === 'object' && logo !== null && 'url' in logo) { + const url = (logo as { url?: string | null }).url + return url ?? null + } + return null +} + const IMG_BG = '/images/figma/footer-bg.webp' const LOGO_G1 = '/images/figma/logo-g1-lg.svg' const LOGO_G2 = '/images/figma/logo-g2-lg.svg' @@ -41,6 +52,8 @@ export async function Footer() { const navLinks = footer?.navLinks?.length ? footer.navLinks : STATIC_NAV const contacts = footer?.contacts const socials = footer?.socials?.filter((s) => s.url) + const logoUrl = resolveLogoUrl(footer?.logo) + const cmsLogo = logoUrl ? { url: logoUrl, alt: footer?.logoAlt ?? 'Шуміленд' } : null return (