This commit is contained in:
parent
a6ce98bff0
commit
9b6da3fd28
|
|
@ -12,21 +12,13 @@ import {
|
|||
type CarouselApi,
|
||||
} from "@/ui/carousel";
|
||||
import FireNewsList from "./FireNewsList";
|
||||
const imageUrls = [
|
||||
|
||||
"/images/carousel-1.jpg",
|
||||
"/images/carousel-2.jpg",
|
||||
"/images/carousel-3.jpg",
|
||||
"/images/carousel-4.jpg",
|
||||
"/images/carousel-5.jpg",
|
||||
"/images/carousel-6.jpg",
|
||||
];
|
||||
export function CarouselDemo() {
|
||||
const [api, setApi] = React.useState<CarouselApi>();
|
||||
const [current, setCurrent] = React.useState(0);
|
||||
const [count, setCount] = React.useState(0);
|
||||
|
||||
const totalSlides = imageUrls.length;
|
||||
const totalSlides = 6;
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!api) return;
|
||||
|
|
@ -40,7 +32,7 @@ export function CarouselDemo() {
|
|||
}, [api]);
|
||||
|
||||
return (
|
||||
<div className="relative w-full max-w-xs">
|
||||
<div className="relative w-full max-w-4xl mx-auto">
|
||||
<Carousel
|
||||
opts={{
|
||||
loop: true,
|
||||
|
|
@ -52,19 +44,21 @@ export function CarouselDemo() {
|
|||
}),
|
||||
]}
|
||||
setApi={setApi}
|
||||
className="w-full"
|
||||
>
|
||||
<CarouselContent>
|
||||
{imageUrls.map((src, index) => (
|
||||
<CarouselItem key={index}>
|
||||
<CarouselContent className="h-full w-full">
|
||||
{Array.from({ length: totalSlides }).map((_, index) => (
|
||||
<CarouselItem key={index} className="w-full h-full">
|
||||
<div className="p-1">
|
||||
<Card>
|
||||
<CardContent className="flex aspect-square items-center justify-center p-6">
|
||||
<img
|
||||
src={src}
|
||||
alt={`Slide ${index + 1}`}
|
||||
className="w-full h-full object-cover"
|
||||
/>
|
||||
<CardContent className="flex aspect-square items-center justify-center ">
|
||||
<div
|
||||
className="w-full h-full"
|
||||
style={{
|
||||
backgroundImage: "url('/app/images/header.png')",
|
||||
backgroundSize: '100% 100%',
|
||||
}}
|
||||
>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export function Header(){
|
|||
|
||||
return (
|
||||
<div
|
||||
className="relative w-[1280px] h-[704px] bg-cover bg-center left-1/2 transform -translate-x-1/2"
|
||||
className="relative w-full h-180 bg-cover bg-center left-1/2 transform -translate-x-1/2"
|
||||
style={{ backgroundImage: "url('/app/images/header.png')" }}
|
||||
>
|
||||
{/* 时间显示 只显示日期: "2025/3/15"*/}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { CarouselDemo } from "@/components/Carousel";
|
||||
|
||||
import type { Route } from "./+types/news";
|
||||
import Integrated from "@/components/news/body/Integrated";
|
||||
import CultureBgPage from "@/components/news/body/Culturebg";
|
||||
|
|
@ -6,6 +6,7 @@ import {Header} from "@/components/header/Header";
|
|||
import {TopNav} from "@/components/header/TopNav";
|
||||
import NewsList from "@/components/list/NewsList";
|
||||
import ImageGridSection from "@/components/body/ImageGridSection";
|
||||
import { CarouselDemo } from "@/components/Carousel";
|
||||
export function meta( ) {
|
||||
return [
|
||||
{ title: "New React Router App" },
|
||||
|
|
@ -19,10 +20,10 @@ export default function Home() {
|
|||
<div>
|
||||
<Header />
|
||||
<TopNav />
|
||||
|
||||
<CarouselDemo />
|
||||
<NewsList />
|
||||
<ImageGridSection />
|
||||
<Integrated />
|
||||
{/* <Integrated /> */}
|
||||
<CultureBgPage />
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue