Compare commits

..

No commits in common. "8869d052a14b6d0800e0551c37fe786d06c76eb7" and "99e86b2ff5f4383f0e1a817969f2142e1ad8a478" have entirely different histories.

3 changed files with 22 additions and 49 deletions

View File

@ -16,14 +16,8 @@ const NewsItem: React.FC<NewsProps> = ({ title = '', time = '', url = '' }) => {
onClick={() => url && window.open(url)}
className="flex items-center justify-between hover:text-blue-600 cursor-pointer transition duration-300 ease-in-out"
>
{/* 标题部分:左侧 */}
<div className="flex items-center">
<div className="w-2 h-2 bg-white rounded-full mr-2"></div>
<h3 className="text-lg font-semibold text-white hover:text-blue-600">{title}</h3>
</div>
{/* 时间部分:右侧 */}
<p className="text-sm text-white hover:text-blue-600 text-right">{time}</p>
<h3 className="text-lg font-semibold text-gray-800">{title}</h3>
<p className="text-sm text-gray-500">{time}</p>
</div>
</div>
);

View File

@ -11,10 +11,10 @@ const NewsItem: React.FC<NewsProps> = ({ title = '', time = '', url = '' }) => {
return (
<div className="mb-4">
<div
onClick={() => url && window.open(url)} // 点击时打开链接
onClick={() => url && window.open(url)}
className="flex items-center justify-between hover:text-blue-600 cursor-pointer transition duration-300 ease-in-out"
>
<h3 className="text-lg font-semibold text-gray-800 hover:text-blue-600 transition duration-300 ease-in-out">{title}</h3>
<h3 className="text-lg font-semibold text-gray-800">{title}</h3>
<p className="text-sm text-gray-500">{time}</p>
</div>
</div>
@ -28,55 +28,34 @@ const NewsList: React.FC = () => {
const educationNews = mockNewsData.filter((news) => news.type === "教育");
return (
<div className="bg-gray-50 p-8 rounded-2xl shadow-xl w-4/5 mx-auto">
{/* 使用 Flexbox 将两个列表放在一行 */}
<div className="flex gap-8">
<div className="bg-gray-100 p-6 rounded-lg shadow-md w-4/5 mx-auto">
<div className="grid grid-cols-1 md:grid-cols-2 gap-8">
{/* 科技新闻 */}
<div className="flex-1 bg-white rounded-lg shadow-md">
{/* 标题栏:独立于列表之外 */}
<div className="flex items-center justify-between mb-6">
<div className="bg-blue-500 text-white px-6 py-3 font-bold text-4xl">
</div>
<button className="text-base text-blue-300 hover:text-blue-400 transition duration-200 pl-6 pr-6">
[]
<div className="bg-white p-6 rounded-lg shadow-sm">
<div className="flex items-center justify-between mb-4">
<p className="text-xl font-bold text-gray-900"></p>
<button className="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-md transition duration-300 ease-in-out">
</button>
</div>
{/* 新闻列表 */}
<ul className="space-y-4 pl-6 pr-6 pb-6">
<ul className="space-y-4">
{techNews.map((news) => (
<NewsItem
key={news.id}
title={news.title}
time={news.time}
url={news.url} // 确保 mockNewsData 中有 url 字段
/>
<NewsItem key={news.id} title={news.title} time={news.time} url={news.url} />
))}
</ul>
</div>
{/* 教育新闻 */}
<div className="flex-1 bg-white rounded-lg shadow-md">
{/* 标题栏:独立于列表之外 */}
<div className="flex items-center justify-between mb-6">
<div className="bg-blue-500 text-white px-6 py-3 font-bold text-4xl">
</div>
<button className="text-base text-blue-300 hover:text-blue-400 transition duration-200 pl-6 pr-6">
[]
<div className="bg-white p-6 rounded-lg shadow-sm">
<div className="flex items-center justify-between mb-4">
<p className="text-xl font-bold text-gray-900"></p>
<button className="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded-md transition duration-300 ease-in-out">
</button>
</div>
{/* 新闻列表 */}
<ul className="space-y-4 pl-6 pr-6 pb-6">
<ul className="space-y-4">
{educationNews.map((news) => (
<NewsItem
key={news.id}
title={news.title}
time={news.time}
url={news.url} // 确保 mockNewsData 中有 url 字段
/>
<NewsItem key={news.id} title={news.title} time={news.time} url={news.url} />
))}
</ul>
</div>

View File

@ -3,7 +3,7 @@ import List from '@/components/list/List';
export default function GrassrootsDynamics() {
return (
<div className="flex rounded-2xl mx-auto w-4/5 h-140 mt-10 p-10">
<div className="flex bg-white rounded-2xl mx-auto w-4/5">
<div className="w-2/5 p-6 flex flex-col items-center justify-center relative">
<div >
<img
@ -15,7 +15,7 @@ export default function GrassrootsDynamics() {
</div>
{/* 右边列表 */}
<div className="w-3/5 p-6 flex flex-col bg-[#0e93df] text-white">
<div className="w-3/5 text-white p-6">
<List />
</div>
</div>