fix the PR gated
This commit is contained in:
parent
effd1d38d0
commit
ca4dfec84b
4 changed files with 31 additions and 7 deletions
ui
|
@ -1,7 +1,6 @@
|
||||||
import { fetchNewsData } from "../../../lib/fetchNewsData";
|
import { fetchNewsData } from "../../../lib/fetchNewsData";
|
||||||
import NewsDetail from "../../../components/NewsDetail";
|
import NewsDetail from "../../../components/NewsDetail";
|
||||||
|
|
||||||
|
|
||||||
export default async function NewsPage({ params }: { params: { id: string } }) {
|
export default async function NewsPage({ params }: { params: { id: string } }) {
|
||||||
const newsData = await fetchNewsData(params.id);
|
const newsData = await fetchNewsData(params.id);
|
||||||
|
|
||||||
|
@ -10,4 +9,4 @@ export default async function NewsPage({ params }: { params: { id: string } }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return <NewsDetail news={newsData} />;
|
return <NewsDetail news={newsData} />;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,4 @@ const Layout = ({ children }: { children: React.ReactNode }) => {
|
||||||
return <div>{children}</div>;
|
return <div>{children}</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Layout;
|
export default Layout;
|
||||||
|
|
|
@ -1,13 +1,38 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import ContextItem from "./ContextItem";
|
import ContextItem from "./ContextItem";
|
||||||
|
|
||||||
|
interface ContextItemType {
|
||||||
|
name: string;
|
||||||
|
url: string;
|
||||||
|
description: string;
|
||||||
|
provider: {
|
||||||
|
name: string;
|
||||||
|
image?: {
|
||||||
|
thumbnail: {
|
||||||
|
contentUrl: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}[];
|
||||||
|
datePublished: string;
|
||||||
|
image?: {
|
||||||
|
contentUrl: string;
|
||||||
|
thumbnail: {
|
||||||
|
contentUrl: string;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
article?: string;
|
||||||
|
score?: number;
|
||||||
|
}
|
||||||
|
|
||||||
interface NewsDetailProps {
|
interface NewsDetailProps {
|
||||||
news: {
|
news: {
|
||||||
title: string;
|
title: string;
|
||||||
sections: {
|
sections: {
|
||||||
title: string;
|
title: string;
|
||||||
content: string;
|
content: string;
|
||||||
context: any[];
|
context: ContextItemType[];
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -32,4 +57,4 @@ const NewsDetail: React.FC<NewsDetailProps> = ({ news }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default NewsDetail;
|
export default NewsDetail;
|
|
@ -52,7 +52,7 @@ const NewsPage = () => {
|
||||||
<div className="flex flex-row items-center justify-center min-h-screen">
|
<div className="flex flex-row items-center justify-center min-h-screen">
|
||||||
<p className="text-black/70 dark:text-white/70 text-sm">Loading news...</p>
|
<p className="text-black/70 dark:text-white/70 text-sm">Loading news...</p>
|
||||||
</div>
|
</div>
|
||||||
) : error ? (
|
) : (error ? (
|
||||||
<div className="flex flex-col items-center justify-center min-h-screen">
|
<div className="flex flex-col items-center justify-center min-h-screen">
|
||||||
<p className="text-red-500 text-sm mb-2">Failed to load news.</p>
|
<p className="text-red-500 text-sm mb-2">Failed to load news.</p>
|
||||||
<p className="text-red-500 text-xs">{error}</p>
|
<p className="text-red-500 text-xs">{error}</p>
|
||||||
|
@ -77,7 +77,7 @@ const NewsPage = () => {
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue