make colelctions optional in react component

This commit is contained in:
Zotov Ivan Yuryevich
2026-04-20 23:26:56 +03:00
parent 17bcf316da
commit 08f1e352a6
9 changed files with 211 additions and 11 deletions

View File

@@ -7,11 +7,11 @@ import type { SiteConfigContact } from '../lib/cms/contact/types'
type CategoryNavItem = NonNullable<MenuItemsQuery['categories'][number]>
export interface FooterProps {
contacts: readonly SiteConfigContact[]
solutionCategories: CategoryNavItem[]
contacts?: readonly SiteConfigContact[]
solutionCategories?: CategoryNavItem[]
}
export function Footer({ contacts, solutionCategories }: FooterProps) {
export function Footer({ contacts = [], solutionCategories = [] }: FooterProps) {
return (
<footer className="bg-gray-900 text-gray-400 pt-20 pb-10 border-t border-gray-800">
<div className="max-w-400 mx-auto px-6 xl:px-12 2xl:px-16">

View File

@@ -8,12 +8,12 @@ import { navigateHomeSectionAnchor } from '../lib/scrollToHash'
type CategoryNavItem = NonNullable<MenuItemsQuery['categories'][number]>
export interface HeaderProps {
contacts: readonly SiteConfigContact[]
solutions: readonly CategoryNavItem[]
services: readonly CategoryNavItem[]
contacts?: readonly SiteConfigContact[]
solutions?: readonly CategoryNavItem[]
services?: readonly CategoryNavItem[]
}
export function Header({ contacts, solutions, services }: HeaderProps) {
export function Header({ contacts = [], solutions = [], services = [] }: HeaderProps) {
const [isMenuOpen, setIsMenuOpen] = useState(false)
const [isSolutionsOpen, setIsSolutionsOpen] = useState(false)
const [isServicesOpen, setIsServicesOpen] = useState(false)