add
This commit is contained in:
parent
b60ed49957
commit
1e55baa2f3
Before Width: | Height: | Size: 231 KiB After Width: | Height: | Size: 231 KiB |
|
@ -18,41 +18,41 @@ import type { CarouselRef } from "antd/es/carousel";
|
||||||
import { useAppConfig } from "@nice/client";
|
import { useAppConfig } from "@nice/client";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
interface PlatformStat {
|
// interface PlatformStat {
|
||||||
icon: React.ReactNode;
|
// icon: React.ReactNode;
|
||||||
value: number;
|
// value: number;
|
||||||
label: string;
|
// label: string;
|
||||||
}
|
// }
|
||||||
|
|
||||||
const HeroSection = () => {
|
const HeroSection = () => {
|
||||||
const carouselRef = useRef<CarouselRef>(null);
|
const carouselRef = useRef<CarouselRef>(null);
|
||||||
const { statistics, slides, slideLinks = [] } = useAppConfig();
|
const { statistics, slides, slideLinks = [] } = useAppConfig();
|
||||||
const [countStatistics, setCountStatistics] = useState<number>(4);
|
const [countStatistics, setCountStatistics] = useState<number>(4);
|
||||||
const navigator = useNavigate()
|
const navigator = useNavigate();
|
||||||
const platformStats: PlatformStat[] = useMemo(() => {
|
// const platformStats: PlatformStat[] = useMemo(() => {
|
||||||
return [
|
// return [
|
||||||
{
|
// {
|
||||||
icon: <TeamOutlined />,
|
// icon: <TeamOutlined />,
|
||||||
value: statistics.staffs,
|
// value: statistics.staffs,
|
||||||
label: "注册学员",
|
// label: "注册学员",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
icon: <StarOutlined />,
|
// icon: <StarOutlined />,
|
||||||
value: statistics.courses,
|
// value: statistics.courses,
|
||||||
label: "精品课程",
|
// label: "精品课程",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
icon: <BookOutlined />,
|
// icon: <BookOutlined />,
|
||||||
value: statistics.lectures,
|
// value: statistics.lectures,
|
||||||
label: "课程章节",
|
// label: "课程章节",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
icon: <EyeOutlined />,
|
// icon: <EyeOutlined />,
|
||||||
value: statistics.reads,
|
// value: statistics.reads,
|
||||||
label: "播放次数",
|
// label: "播放次数",
|
||||||
},
|
// },
|
||||||
];
|
// ];
|
||||||
}, [statistics]);
|
// }, [statistics]);
|
||||||
const handlePrev = useCallback(() => {
|
const handlePrev = useCallback(() => {
|
||||||
carouselRef.current?.prev();
|
carouselRef.current?.prev();
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -80,12 +80,16 @@ const HeroSection = () => {
|
||||||
className="h-[600px] mb-24"
|
className="h-[600px] mb-24"
|
||||||
dots={{
|
dots={{
|
||||||
className: "carousel-dots !bottom-32 !z-20",
|
className: "carousel-dots !bottom-32 !z-20",
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{Array.isArray(slides) ? (
|
{Array.isArray(slides) ? (
|
||||||
slides.map((item, index) => (
|
slides.map((item, index) => (
|
||||||
<div key={index} className="relative h-[600px] cursor-pointer"
|
<div
|
||||||
|
key={index}
|
||||||
|
className="relative h-[600px] cursor-pointer"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if(slideLinks?.[index])window.open(slideLinks?.[index],"_blank")
|
if (slideLinks?.[index])
|
||||||
|
window.open(slideLinks?.[index], "_blank");
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
@ -114,13 +118,15 @@ const HeroSection = () => {
|
||||||
<button
|
<button
|
||||||
onClick={handlePrev}
|
onClick={handlePrev}
|
||||||
className="absolute left-4 md:left-8 top-1/2 -translate-y-1/2 z-10 opacity-0 group-hover:opacity-100 transition-all duration-300 bg-black/20 hover:bg-black/30 w-12 h-12 flex items-center justify-center rounded-full transform hover:scale-110 hover:shadow-lg"
|
className="absolute left-4 md:left-8 top-1/2 -translate-y-1/2 z-10 opacity-0 group-hover:opacity-100 transition-all duration-300 bg-black/20 hover:bg-black/30 w-12 h-12 flex items-center justify-center rounded-full transform hover:scale-110 hover:shadow-lg"
|
||||||
aria-label="Previous slide">
|
aria-label="Previous slide"
|
||||||
|
>
|
||||||
<LeftOutlined className="text-white text-xl" />
|
<LeftOutlined className="text-white text-xl" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={handleNext}
|
onClick={handleNext}
|
||||||
className="absolute right-4 md:right-8 top-1/2 -translate-y-1/2 z-10 opacity-0 group-hover:opacity-100 transition-all duration-300 bg-black/20 hover:bg-black/30 w-12 h-12 flex items-center justify-center rounded-full transform hover:scale-110 hover:shadow-lg"
|
className="absolute right-4 md:right-8 top-1/2 -translate-y-1/2 z-10 opacity-0 group-hover:opacity-100 transition-all duration-300 bg-black/20 hover:bg-black/30 w-12 h-12 flex items-center justify-center rounded-full transform hover:scale-110 hover:shadow-lg"
|
||||||
aria-label="Next slide">
|
aria-label="Next slide"
|
||||||
|
>
|
||||||
<RightOutlined className="text-white text-xl" />
|
<RightOutlined className="text-white text-xl" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -129,24 +135,24 @@ const HeroSection = () => {
|
||||||
{countStatistics > 1 && (
|
{countStatistics > 1 && (
|
||||||
<div className="absolute -bottom-20 left-1/2 -translate-x-1/2 w-3/5 max-w-6xl px-4">
|
<div className="absolute -bottom-20 left-1/2 -translate-x-1/2 w-3/5 max-w-6xl px-4">
|
||||||
<div
|
<div
|
||||||
className={`rounded-2xl grid grid-cols-${countStatistics} lg:grid-cols-${countStatistics} md:grid-cols-${countStatistics} gap-4 md:gap-8 p-6 md:p-8 bg-white border shadow-xl hover:shadow-2xl transition-shadow duration-500 will-change-[transform,box-shadow]`}>
|
className={`rounded-2xl grid grid-cols-${countStatistics} lg:grid-cols-${countStatistics} md:grid-cols-${countStatistics} gap-4 md:gap-8 p-6 md:p-8 bg-white border shadow-xl hover:shadow-2xl transition-shadow duration-500 will-change-[transform,box-shadow]`}
|
||||||
{platformStats.map((stat, index) => {
|
>
|
||||||
|
{/* {platformStats.map((stat, index) => {
|
||||||
return stat.value ? (
|
return stat.value ? (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
className="text-center transform hover:-translate-y-1 hover:scale-105 transition-transform duration-300 ease-out">
|
className="text-center transform hover:-translate-y-1 hover:scale-105 transition-transform duration-300 ease-out"
|
||||||
|
>
|
||||||
<div className="inline-flex items-center justify-center w-16 h-16 mb-4 rounded-full bg-primary-50 text-primary-600 text-3xl transition-colors duration-300 group-hover:text-primary-700">
|
<div className="inline-flex items-center justify-center w-16 h-16 mb-4 rounded-full bg-primary-50 text-primary-600 text-3xl transition-colors duration-300 group-hover:text-primary-700">
|
||||||
{stat.icon}
|
{stat.icon}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-2xl font-bold bg-gradient-to-r from-gray-800 to-gray-600 bg-clip-text text-transparent mb-1.5">
|
<div className="text-2xl font-bold bg-gradient-to-r from-gray-800 to-gray-600 bg-clip-text text-transparent mb-1.5">
|
||||||
{stat.value}
|
{stat.value}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-gray-600 font-medium">
|
<div className="text-gray-600 font-medium">{stat.label}</div>
|
||||||
{stat.label}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
) : null;
|
) : null;
|
||||||
})}
|
})} */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue