From cf3e242462017286cfd0665f4c5c80097719f0b8 Mon Sep 17 00:00:00 2001 From: ditiqi Date: Mon, 24 Feb 2025 20:24:17 +0800 Subject: [PATCH] add --- .../app/main/home/components/HeroSection.tsx | 245 ++++++++---------- 1 file changed, 110 insertions(+), 135 deletions(-) diff --git a/apps/web/src/app/main/home/components/HeroSection.tsx b/apps/web/src/app/main/home/components/HeroSection.tsx index 3dac945..9dae829 100755 --- a/apps/web/src/app/main/home/components/HeroSection.tsx +++ b/apps/web/src/app/main/home/components/HeroSection.tsx @@ -1,160 +1,135 @@ -import React, { useRef, useCallback } from 'react'; -import { Button, Carousel, Typography } from 'antd'; +import React, { useRef, useCallback } 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'; + TeamOutlined, + BookOutlined, + StarOutlined, + ClockCircleOutlined, + LeftOutlined, + RightOutlined, + EyeOutlined, +} from "@ant-design/icons"; +import type { CarouselRef } from "antd/es/carousel"; const { Title, Text } = Typography; interface CarouselItem { - title: string; - desc: string; - image: string; - action: string; - color: string; + title: string; + desc: string; + image: string; + action: string; + color: string; } interface PlatformStat { - icon: React.ReactNode; - value: string; - label: string; + 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' - } + { + 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 platformStats: PlatformStat[] = [ - { icon: , value: '50,000+', label: '注册学员' }, - { icon: , value: '1,000+', label: '精品课程' }, - // { icon: , value: '98%', label: '好评度' }, - { icon: , value: '100万+', label: '观看次数' } + { icon: , value: "50,000+", label: "注册学员" }, + { icon: , value: "1,000+", label: "精品课程" }, + // { icon: , value: '98%', label: '好评度' }, + { icon: , value: "100万+", label: "观看次数" }, ]; const HeroSection = () => { - const carouselRef = useRef(null); + const carouselRef = useRef(null); - const handlePrev = useCallback(() => { - carouselRef.current?.prev(); - }, []); + const handlePrev = useCallback(() => { + carouselRef.current?.prev(); + }, []); - const handleNext = useCallback(() => { - carouselRef.current?.next(); - }, []); + const handleNext = useCallback(() => { + carouselRef.current?.next(); + }, []); - return ( -
-
- - {carouselItems.map((item, index) => ( -
-
-
-
+ return ( +
+
+ + {carouselItems.map((item, index) => ( +
+
+
+
- {/* Content Container */} -
-
- - {item.title} - - - {item.desc} - - -
-
-
- ))} - + {/* Content Container */} +
+
+ ))} + - {/* Navigation Buttons */} - - -
+ {/* Navigation Buttons */} + + +
- {/* Stats Container */} -
-
- {platformStats.map((stat, index) => ( -
-
- {stat.icon} -
-
- {stat.value} -
-
- {stat.label} -
-
- ))} -
-
-
- ); + {/* Stats Container */} +
+
+ {platformStats.map((stat, index) => ( +
+
+ {stat.icon} +
+
+ {stat.value} +
+
+ {stat.label} +
+
+ ))} +
+
+
+ ); }; -export default HeroSection; \ No newline at end of file +export default HeroSection;