refactor: P0 - remove testimonial, migrate footer & mobile menu to NAVIGATION_V2

- Remove TestimonialSection from homepage (no customers yet)
- Footer: dark theme, NAVIGATION_V2 + MEGA_DROPDOWN_DATA links
- Mobile Menu: NAVIGATION_V2 with collapsible dropdown support
This commit is contained in:
张翔
2026-04-30 22:00:00 +08:00
parent b6d2313e8f
commit fe6e4b1c54
24 changed files with 8928 additions and 129 deletions
+56 -28
View File
@@ -1,8 +1,9 @@
'use client';
import { useState, useEffect } from 'react';
import { Menu, X } from 'lucide-react';
import { NAVIGATION } from '@/lib/constants';
import { Menu, X, ChevronDown } from 'lucide-react';
import { StaticLink } from '@/components/ui/static-link';
import { NAVIGATION_V2, MEGA_DROPDOWN_DATA } from '@/lib/constants';
import { cn } from '@/lib/utils';
import { useFocusTrap } from '@/hooks/use-focus-trap';
@@ -12,6 +13,7 @@ interface MobileMenuProps {
export function MobileMenu({ className }: MobileMenuProps) {
const [isOpen, setIsOpen] = useState(false);
const [expandedDropdown, setExpandedDropdown] = useState<string | null>(null);
const focusTrapRef = useFocusTrap<HTMLDivElement>(isOpen);
useEffect(() => {
@@ -20,34 +22,25 @@ export function MobileMenu({ className }: MobileMenuProps) {
} else {
document.body.style.overflow = 'unset';
}
return () => {
document.body.style.overflow = 'unset';
};
}, [isOpen]);
const handleNavClick = (id: string) => {
setIsOpen(false);
const element = document.getElementById(id);
if (element) {
element.scrollIntoView({ behavior: 'smooth' });
}
};
const handleKeyDown = (event: React.KeyboardEvent, id?: string) => {
const handleKeyDown = (event: React.KeyboardEvent, action?: () => void) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
if (id) {
handleNavClick(id);
} else {
setIsOpen(!isOpen);
}
action?.();
}
if (event.key === 'Escape' && isOpen) {
setIsOpen(false);
}
};
const toggleDropdown = (key: string) => {
setExpandedDropdown(expandedDropdown === key ? null : key);
};
return (
<div className={cn('lg:hidden', className)} ref={focusTrapRef}>
<button
@@ -72,24 +65,59 @@ export function MobileMenu({ className }: MobileMenuProps) {
onClick={() => setIsOpen(false)}
aria-hidden="true"
/>
<nav
<nav
id="mobile-menu-panel"
className="fixed top-16 left-0 right-0 bg-white border-b border-[#E5E5E5] z-50 shadow-lg"
className="fixed top-16 left-0 right-0 bg-white border-b border-[#E5E5E5] z-50 shadow-lg max-h-[calc(100vh-4rem)] overflow-y-auto"
role="navigation"
aria-label="移动端导航"
>
<div className="container-wide py-4">
<ul className="space-y-1" role="list">
{NAVIGATION.map((item) => (
{NAVIGATION_V2.map((item) => (
<li key={item.id}>
<button
onClick={() => handleNavClick(item.id)}
onKeyDown={(e) => handleKeyDown(e, item.id)}
className="block w-full text-left px-4 py-4 text-[#171717] hover:bg-[#FEF2F4] hover:text-[#C41E3A] rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-[#C41E3A] focus:ring-inset min-h-[48px]"
>
{item.label}
</button>
{item.hasDropdown && item.dropdownKey ? (
<div>
<button
onClick={() => toggleDropdown(item.dropdownKey!)}
onKeyDown={(e) => handleKeyDown(e, () => toggleDropdown(item.dropdownKey!))}
className="flex items-center justify-between w-full text-left px-4 py-4 text-[#171717] hover:bg-[#FEF2F4] hover:text-[#C41E3A] rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-[#C41E3A] focus:ring-inset min-h-[48px]"
aria-expanded={expandedDropdown === item.dropdownKey}
>
{item.label}
<ChevronDown
className={cn(
'w-4 h-4 transition-transform duration-200',
expandedDropdown === item.dropdownKey && 'rotate-180'
)}
/>
</button>
{expandedDropdown === item.dropdownKey && (
<ul className="pl-4 space-y-1 mt-1 mb-2" role="list">
{(MEGA_DROPDOWN_DATA[item.dropdownKey] ?? []).map((sub) => (
<li key={sub.id}>
<StaticLink
href={sub.href}
onClick={() => setIsOpen(false)}
className="block px-4 py-3 text-sm text-[#595959] hover:text-[#C41E3A] hover:bg-[#FEF2F4] rounded-md transition-colors"
>
<span className="font-medium text-[#1C1C1C]">{sub.title}</span>
<span className="block text-xs text-[#8C8C8C] mt-0.5">{sub.description}</span>
</StaticLink>
</li>
))}
</ul>
)}
</div>
) : (
<StaticLink
href={item.href}
onClick={() => setIsOpen(false)}
className="block px-4 py-4 text-[#171717] hover:bg-[#FEF2F4] hover:text-[#C41E3A] rounded-md transition-colors min-h-[48px]"
>
{item.label}
</StaticLink>
)}
</li>
))}
</ul>