From 23ff02673e94fd26ed2b02ce4b8eb0faf9b5531f Mon Sep 17 00:00:00 2001 From: Li1304553726 <1304553726@qq.com> Date: Thu, 20 Nov 2025 10:50:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=BD=AE=E6=92=AD=E5=9B=BE=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E8=87=AA=E9=80=82=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/Carousel.tsx | 24 +++++++++--------- app/components/news/header/TopNav.tsx | 35 +++++++++++++-------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/app/components/Carousel.tsx b/app/components/Carousel.tsx index da0724e..6150276 100755 --- a/app/components/Carousel.tsx +++ b/app/components/Carousel.tsx @@ -87,27 +87,29 @@ export function CarouselDemo({ }), ]} setApi={setApi} // 将 Embla 实例保存到 state 中 - className="w-full h-full" // 占满容器 + className="w-full" // 占满容器 > {/* 轮播内容区域 */} - + {/* 遍历图片数组,为每张图创建一个轮播项 */} {imageUrls.map((src, index) => ( {/* 内部包裹层:无内边距,占满 */} -
+
{/* 使用 CardContent 包裹图片,移除默认间距 */} - + {/* 图片元素:自动填充容器,保持比例裁剪 */} - {`Slide +
{/* 可选:设置固定宽高比 */} + {`Slide +
diff --git a/app/components/news/header/TopNav.tsx b/app/components/news/header/TopNav.tsx index d9791e5..16ddd42 100644 --- a/app/components/news/header/TopNav.tsx +++ b/app/components/news/header/TopNav.tsx @@ -1,5 +1,5 @@ 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; @@ -25,11 +25,11 @@ export function TopNav({ activeKey: externalActiveKey, onSearch, onItemClick, -}: TopNavProps){ +}: TopNavProps) { const [internalActiveKey, setInternalActiveKey] = useState('home'); const currentActiveKey = externalActiveKey !== undefined ? externalActiveKey : internalActiveKey; const [searchKeyword, setSearchKeyword] = useState(''); - + const handleSearchSubmit = (e: React.FormEvent) => { e.preventDefault(); @@ -49,24 +49,24 @@ export function TopNav({ {/* 搜索框与导航菜单组合 */}
{/* 搜索框 */} - +
- 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" /> + 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; @@ -74,9 +74,8 @@ export function TopNav({