'use client'; import { motion } from 'framer-motion'; import { useInView } from 'framer-motion'; import { useRef, useMemo } from 'react'; import Link from 'next/link'; import { Code, Cloud, BarChart3, Shield, ArrowRight } from 'lucide-react'; import { Card, CardContent } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { useServices } from '@/hooks/use-services'; const iconMap: Record> = { Code, Cloud, BarChart3, Shield, }; interface ServicesConfig { enabled?: boolean; items?: string[]; } interface ServicesSectionProps { config?: ServicesConfig; } export function ServicesSection({ config }: ServicesSectionProps) { const ref = useRef(null); const isInView = useInView(ref, { once: true, margin: '-100px' }); const { services, loading, error } = useServices(); const filteredServices = useMemo(() => { if (!services || services.length === 0) { return []; } if (!config?.items || config.items.length === 0) { return services; } return services.filter(service => config.items?.includes(service.id)); }, [services, config]); if (loading) { return (

加载中...

); } if (error) { return (

加载服务信息失败,请稍后重试

); } return (

我们的 核心业务

专业技术团队,为您提供全方位的数字化解决方案

{filteredServices.length > 0 ? (
{filteredServices.map((service, index) => { const Icon = iconMap[service.icon]; return (
{Icon && }

{service.title}

{service.description}

了解详情
); })}
) : (

暂无服务信息

)}
); }