import React, { useRef, useCallback, useEffect } from "react"; import { Button, Carousel, Typography } from "antd"; import { TeamOutlined, BookOutlined, StarOutlined, ClockCircleOutlined, LeftOutlined, RightOutlined, EyeOutlined, } from "@ant-design/icons"; import type { CarouselRef } from "antd/es/carousel"; import { useAppConfig } from "@nice/client"; const { Title, Text } = Typography; interface CarouselItem { title: string; desc: string; image: string; action: string; color: string; } interface PlatformStat { icon: React.ReactNode; value: string; label: string; } const carouselItems: CarouselItem[] = [ { title: "探索编程世界", desc: "从零开始学习编程,开启你的技术之旅", image: "/images/banner1.jpg", action: "立即开始", color: "from-blue-600/90", }, { title: "人工智能课程", desc: "掌握AI技术,引领未来发展", image: "/images/banner2.jpg", action: "了解更多", color: "from-purple-600/90", }, ]; const HeroSection = () => { const carouselRef = useRef(null); const { statistics, baseSetting } = useAppConfig(); const platformStats: PlatformStat[] = [ { icon: , value: statistics.staffs.toString(), label: "注册学员", }, { icon: , value: statistics.courses.toString(), label: "精品课程", }, { icon: , value: statistics.lectures.toString(), label: "课程章节", }, { icon: , value: statistics.reads.toString(), label: "观看次数", }, ]; const handlePrev = useCallback(() => { carouselRef.current?.prev(); }, []); const handleNext = useCallback(() => { carouselRef.current?.next(); }, []); const { slides } = useAppConfig(); useEffect(() => { console.log(statistics); }, [statistics]); return (
{Array.isArray(slides) ? ( slides.map((item, index) => (
{/*
*/}
{/* Content Container */}
)) ) : (
)} {/* Navigation Buttons */}
{/* Stats Container */}
{platformStats.map((stat, index) => (
{stat.icon}
{stat.value}
{stat.label}
))}
); }; export default HeroSection;