diff --git a/app/components/Carousel.tsx b/app/components/Carousel.tsx index 654a6c7..ebc7ad1 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/body/FireNews/ImportantNews.tsx b/app/components/news/body/FireNews/ImportantNews.tsx index b4a68a2..fec4d77 100644 --- a/app/components/news/body/FireNews/ImportantNews.tsx +++ b/app/components/news/body/FireNews/ImportantNews.tsx @@ -31,7 +31,7 @@ export function ImportantNews() { })); return( -
+
{/* 轮播背景图 - 确保有明确尺寸 */}
{/* 固定的烽火要闻 */} -
+
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({