diff --git a/app/components/untils/Carousel.tsx b/app/components/Carousel.tsx similarity index 72% rename from app/components/untils/Carousel.tsx rename to app/components/Carousel.tsx index bc6b333..eb036a4 100755 --- a/app/components/untils/Carousel.tsx +++ b/app/components/Carousel.tsx @@ -11,14 +11,25 @@ import { CarouselPrevious, type CarouselApi, } from "@/ui/carousel"; +<<<<<<< HEAD:app/components/untils/Carousel.tsx import FireNewsList from "./FireNewsList"; +======= + const imageUrls = [ +>>>>>>> 1d49f000efd9f3e6ac13da4e459b8e1e600c3335:app/components/Carousel.tsx + "/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(); const [current, setCurrent] = React.useState(0); const [count, setCount] = React.useState(0); - const totalSlides = 6; + const totalSlides = imageUrls.length; React.useEffect(() => { if (!api) return; @@ -32,7 +43,7 @@ export function CarouselDemo() { }, [api]); return ( -
+
- - {Array.from({ length: totalSlides }).map((_, index) => ( - + + {imageUrls.map((src, index) => ( +
+<<<<<<< HEAD:app/components/untils/Carousel.tsx
+======= + + {`Slide +>>>>>>> 1d49f000efd9f3e6ac13da4e459b8e1e600c3335:app/components/Carousel.tsx
diff --git a/app/components/untils/FireNewsList.tsx b/app/components/FireNewsList.tsx similarity index 100% rename from app/components/untils/FireNewsList.tsx rename to app/components/FireNewsList.tsx diff --git a/app/components/body/ImageGridSection.tsx b/app/components/body/ImageGridSection.tsx new file mode 100644 index 0000000..6625297 --- /dev/null +++ b/app/components/body/ImageGridSection.tsx @@ -0,0 +1,103 @@ +import { CarouselDemo } from "@/components/Carousel"; +const ImageGridSection = () => { + // 替换为你自己的图片路径 + const elements = [ + "/images/carousel-1.jpg", + , + "/images/carousel-2.jpg", + "/images/carousel-3.jpg" + ]; + const listItems = [ + '新闻标题一:重要政策发布', + '新闻标题二:经济数据稳步回升', + '新闻标题三:科技创新成果显著', + '新闻标题四:民生工程持续推进', + '新闻标题五:国际交流合作深化' + ]; + return ( +
+ + {/* 左侧:3张图片 + 1个轮播图 2x2 网格 */} +
+ {elements.map((element, index) => ( +
+ {typeof element === 'string' ? ( + {`图片 + ) : ( + element // 如果是 React 元素,则直接渲染 + )} +
+ ))} +
+
+
    + {listItems.map((item, index) => ( +
  • + + {item} +
  • + ))} +
+
+
+ ); +}; +export default ImageGridSection; \ No newline at end of file diff --git a/app/components/list/NewsList.tsx b/app/components/list/NewsList.tsx index 0f74f38..bdc5959 100644 --- a/app/components/list/NewsList.tsx +++ b/app/components/list/NewsList.tsx @@ -2,21 +2,22 @@ import React from 'react'; import { mockNewsData } from './NewsData'; // 导入新闻数据 interface NewsProps { - title?: string; - description?: string; - time?: string; + title?: string; + description?: string; + time?: string; type?: string; url?: string; } const NewsItem: React.FC = ({ title = '', time = '', url = '' }) => { return ( -
-
url && window.open(url)} - className="flex items-center justify-between hover:text-blue-500 - cursor-pointer w-96"> -

{title}

-

{time}

+
+
url && window.open(url)} + className="flex items-center justify-between hover:text-blue-600 cursor-pointer transition duration-300 ease-in-out" + > +

{title}

+

{time}

); @@ -25,16 +26,40 @@ const NewsItem: React.FC = ({ title = '', time = '', url = '' }) => { // 使用新闻数据渲染列表 const NewsList: React.FC = () => { return ( -
-
    - {mockNewsData.map((news) => ( - - ))} -
+
+
+ {/* 科技新闻 */} +
+
+

科技新闻

+ +
+
    + {mockNewsData.map((news, index) => ( + + ))} +
+
+ + {/* 社会新闻 */} +
+
+

社会新闻

+ +
+
    + {mockNewsData.map((news, index) => ( + + ))} +
+
+
); }; - - export default NewsList; \ No newline at end of file diff --git a/app/components/untils/Items.tsx b/app/components/untils/Items.tsx deleted file mode 100755 index e69de29..0000000 diff --git a/app/routes/news.tsx b/app/routes/news.tsx index 973aa4a..dd1e84b 100755 --- a/app/routes/news.tsx +++ b/app/routes/news.tsx @@ -1,10 +1,9 @@ -import { CarouselDemo } from "@/components/untils/Carousel"; +import { CarouselDemo } from "@/components/Carousel"; import type { Route } from "./+types/news"; -import { Header } from "@/components/header/Header"; -import { TopNav } from "@/components/header/TopNav"; +import {Header} from "@/components/header/Header"; +import {TopNav} from "@/components/header/TopNav"; import NewsList from "@/components/list/NewsList"; - - +import ImageGridSection from "@/components/body/ImageGridSection"; export function meta( ) { return [ { title: "New React Router App" }, @@ -17,8 +16,8 @@ export default function Home() {
- - + +
); } diff --git a/public/images/carousel-1.jpg b/public/images/carousel-1.jpg new file mode 100644 index 0000000..dd0a116 Binary files /dev/null and b/public/images/carousel-1.jpg differ diff --git a/public/images/carousel-2.jpg b/public/images/carousel-2.jpg new file mode 100644 index 0000000..39ff910 Binary files /dev/null and b/public/images/carousel-2.jpg differ diff --git a/public/images/carousel-3.jpg b/public/images/carousel-3.jpg new file mode 100644 index 0000000..3b4326e Binary files /dev/null and b/public/images/carousel-3.jpg differ diff --git a/public/images/carousel-4.jpg b/public/images/carousel-4.jpg new file mode 100644 index 0000000..896f77a Binary files /dev/null and b/public/images/carousel-4.jpg differ diff --git a/public/images/carousel-5.jpg b/public/images/carousel-5.jpg new file mode 100644 index 0000000..8cc7d97 Binary files /dev/null and b/public/images/carousel-5.jpg differ diff --git a/public/images/carousel-6.jpg b/public/images/carousel-6.jpg new file mode 100644 index 0000000..030543f Binary files /dev/null and b/public/images/carousel-6.jpg differ