Compare commits

..

No commits in common. "3b6d64df923631a9a959be3cb1166f5be2f03d3f" and "e31bbdf78e55e00065ed3d89dc758d27a80210ad" have entirely different histories.

3 changed files with 37 additions and 51 deletions

View File

@ -11,13 +11,12 @@ interface NewsProps {
const NewsItem: React.FC<NewsProps> = ({ title = '', time = '', url = '' }) => {
return (
<div className="mb-4">
<div
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">{title}</h3>
<p className="text-sm text-gray-500">{time}</p>
<div>
<div onClick={() => url && window.open(url)}
className="flex items-center justify-between hover:text-blue-500
cursor-pointer w-96">
<h3 >{title}</h3>
<p >{time}</p>
</div>
</div>
);
@ -26,40 +25,16 @@ const NewsItem: React.FC<NewsProps> = ({ title = '', time = '', url = '' }) => {
// 使用新闻数据渲染列表
const NewsList: React.FC = () => {
return (
<div className="bg-gray-100 p-6 rounded-lg shadow-md">
<div className="grid grid-cols-1 md:grid-cols-2 gap-8">
{/* 科技新闻 */}
<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">
{mockNewsData.map((news, index) => (
<NewsItem key={index} title={news.title} time={news.time} url={news.url} />
<div>
<ul className="flex flex-col justify-center items-center h-screen">
{mockNewsData.map((news) => (
<NewsItem title={news.title} time={news.time} url={news.url} />
))}
</ul>
</div>
{/* 社会新闻 */}
<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">
{mockNewsData.map((news, index) => (
<NewsItem key={index} title={news.title} time={news.time} url={news.url} />
))}
</ul>
</div>
</div>
</div>
);
};
export default NewsList;

View File

@ -31,7 +31,7 @@ export function CarouselDemo() {
}, [api]);
return (
<div className="relative w-full max-w-xs">
<div className="relative w-full max-w-4xl mx-auto">
<Carousel
opts={{
loop: true,
@ -43,15 +43,24 @@ export function CarouselDemo() {
}),
]}
setApi={setApi}
className="w-full"
>
<CarouselContent>
<CarouselContent className="h-full w-full">
{Array.from({ length: totalSlides }).map((_, index) => (
<CarouselItem key={index}>
<CarouselItem key={index} className="w-full h-full">
<div className="p-1">
<Card>
<CardContent className="flex aspect-square items-center justify-center p-6">
<span className="text-4xl font-semibold">{index + 1}</span>
<CardContent className="flex aspect-square items-center justify-center ">
<div
className="w-full h-full relative"
style={{
backgroundImage: "url('/app/images/header.png')",
backgroundSize: '100% 100%',
}}
>
<div className="absolute top-1 right-1 h-full bg-black">
</div>
</div>
</CardContent>
</Card>
</div>

View File

@ -3,6 +3,8 @@ import type { Route } from "./+types/news";
import { Header } from "@/components/header/Header";
import { TopNav } from "@/components/header/TopNav";
import NewsList from "@/components/list/NewsList";
export function meta( ) {
return [
{ title: "New React Router App" },