diff --git a/app/components/news/body/FireNews/fhjt.tsx b/app/components/news/body/FireNews/fhjt.tsx index 943221a..6d380ec 100644 --- a/app/components/news/body/FireNews/fhjt.tsx +++ b/app/components/news/body/FireNews/fhjt.tsx @@ -4,7 +4,7 @@ import {FireNewsList} from "./FireNewsList"; export function FhjtPage() { return( -
+
{/* 轮播背景图 */}
diff --git a/app/components/news/body/FireNews/fhrx.tsx b/app/components/news/body/FireNews/fhrx.tsx index 6192610..2834797 100644 --- a/app/components/news/body/FireNews/fhrx.tsx +++ b/app/components/news/body/FireNews/fhrx.tsx @@ -4,7 +4,7 @@ import {FireNewsList} from "./FireNewsList"; export function FhrxPage() { return( -
+
{/* 轮播背景图 */}
diff --git a/app/components/news/body/FireNews/fhws.tsx b/app/components/news/body/FireNews/fhws.tsx index 7c04f18..a3f0213 100644 --- a/app/components/news/body/FireNews/fhws.tsx +++ b/app/components/news/body/FireNews/fhws.tsx @@ -4,7 +4,7 @@ import {FireNewsList} from "./FireNewsList"; export function FhwsPage() { return( -
+
{/* 标题部分 */}
diff --git a/app/components/news/body/FireNews/fhyw.tsx b/app/components/news/body/FireNews/fhyw.tsx index 45d7877..7244e31 100644 --- a/app/components/news/body/FireNews/fhyw.tsx +++ b/app/components/news/body/FireNews/fhyw.tsx @@ -1,17 +1,16 @@ import { CarouselDemo } from "@/components/Carousel"; import {FireNewsList} from "./FireNewsList"; - export function FhywPage() { return( -
- {/* 轮播背景图 */} -
+
+ {/* 轮播背景图 - 确保有明确尺寸 */} +
{/* 固定的烽火要闻 */} -
+
diff --git a/app/components/news/body/GrassrootsDynamics.tsx b/app/components/news/body/GrassrootsDynamics.tsx index 3c69570..79c5d45 100644 --- a/app/components/news/body/GrassrootsDynamics.tsx +++ b/app/components/news/body/GrassrootsDynamics.tsx @@ -1,21 +1,24 @@ import React from 'react'; -import List from '@/components/list/List'; +import List from '@/components/news/list/List'; + + export default function GrassrootsDynamics() { return ( -
+
-
+
基层动态
{/* 右边列表 */} -
+
diff --git a/app/components/news/header/TopNav.tsx b/app/components/news/header/TopNav.tsx index b40a7ad..8eaf5ed 100644 --- a/app/components/news/header/TopNav.tsx +++ b/app/components/news/header/TopNav.tsx @@ -1,6 +1,6 @@ import { Search } from 'lucide-react'; -import React, { useState, useEffect } from 'react'; - +import React, { useState,useEffect} from 'react'; +import { Button } from '@/ui/button'; interface MenuItem { label: string; key: string; @@ -29,15 +29,7 @@ export function TopNav({ const [internalActiveKey, setInternalActiveKey] = useState('home'); const currentActiveKey = externalActiveKey !== undefined ? externalActiveKey : internalActiveKey; const [searchKeyword, setSearchKeyword] = useState(''); - const [activeIndex, setActiveIndex] = useState(0); - const [prevIndex, setPrevIndex] = useState(0); - - // 监听激活项变化,更新索引和动画方向 - useEffect(() => { - const currentIndex = menuItems.findIndex(item => item.key === currentActiveKey); - setPrevIndex(activeIndex); - setActiveIndex(currentIndex); - }, [currentActiveKey, menuItems, activeIndex]); + const handleSearchSubmit = (e: React.FormEvent) => { e.preventDefault(); @@ -52,61 +44,53 @@ export function TopNav({ }; return ( -
+ // 将组件宽度调整为1514px,并保持居中 +
{/* 搜索框与导航菜单组合 */} -
+
{/* 搜索框 */} -
-
- setSearchKeyword(e.target.value)} - placeholder="搜索..." - className="pl-10 pr-4 py-2 text-sm border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent w-64 transition-all duration-200 hover:shadow-sm" - /> - - - -
-
+ +
+ - {/* 导航菜单 */} -
    - {/* 滑动背景层 */} -
    - - {menuItems.map((item, index) => { + setSearchKeyword(e.target.value)} + className="pl-5 pr-4 py-2 text-sm h-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent w-64 transition-all duration-200 hover:shadow-sm" /> +
    + + + {/* 导航菜单 */} +
      + {menuItems.map((item) => { const isActive = currentActiveKey === item.key; return ( -
    • +
    • ); })}
    + + +
); diff --git a/app/components/list/List.tsx b/app/components/news/list/List.tsx similarity index 89% rename from app/components/list/List.tsx rename to app/components/news/list/List.tsx index ae0b0ff..b830a2f 100644 --- a/app/components/list/List.tsx +++ b/app/components/news/list/List.tsx @@ -19,11 +19,11 @@ const NewsItem: React.FC = ({ title = '', time = '', url = '' }) => { {/* 标题部分:左侧 */}
-

{title}

+

{title}

{/* 时间部分:右侧 */} -

{time}

+

{time}

); diff --git a/app/components/list/NewsData.tsx b/app/components/news/list/NewsData.tsx similarity index 100% rename from app/components/list/NewsData.tsx rename to app/components/news/list/NewsData.tsx diff --git a/app/components/list/NewsList.tsx b/app/components/news/list/NewsList.tsx similarity index 85% rename from app/components/list/NewsList.tsx rename to app/components/news/list/NewsList.tsx index e219af9..12a9606 100644 --- a/app/components/list/NewsList.tsx +++ b/app/components/news/list/NewsList.tsx @@ -28,18 +28,18 @@ const NewsList: React.FC = () => { const educationNews = mockNewsData.filter((news) => news.type === "教育"); return ( -
+
{/* 使用 Flexbox 将两个列表放在一行 */}
{/* 科技新闻 */}
{/* 标题栏:独立于列表之外 */}
-
+
科技新闻
-
@@ -60,11 +60,11 @@ const NewsList: React.FC = () => {
{/* 标题栏:独立于列表之外 */}
-
+
教育新闻
-
diff --git a/app/routes/news.tsx b/app/routes/news.tsx index 6daf3fb..58fc702 100755 --- a/app/routes/news.tsx +++ b/app/routes/news.tsx @@ -4,7 +4,7 @@ import Integrated from "@/components/news/body/Integrated"; import CultureBgPage from "@/components/news/body/Culturebg"; import {Header} from "@/components/news/header/Header"; import {TopNav} from "@/components/news/header/TopNav"; -import NewsList from "@/components/list/NewsList"; +import NewsList from "@/components/news/list/NewsList"; import ImageGridSection from "@/components/news/body/ImageGridSection"; import GrassrootsDynamics from "@/components/news/body/GrassrootsDynamics"; import { FhywPage } from "@/components/news/body/FireNews/fhyw";