fix the color of dark mode

This commit is contained in:
Yifei Hu 2024-07-10 12:59:34 +08:00
parent e14bb334ba
commit 10b38e392a
2 changed files with 9 additions and 9 deletions

View file

@ -17,8 +17,8 @@ interface ContextItemProps {
const ContextItem: React.FC<ContextItemProps> = ({ item }) => {
return (
<div className="border p-4 rounded-lg mb-4">
<h4 className="font-bold">{item.name}</h4>
<div className="border p-4 rounded-lg mb-4 dark:border-gray-700">
<h4 className="font-bold text-black dark:text-white">{item.name}</h4>
{item.image && (
<Image
src={item.image.contentUrl}
@ -28,8 +28,8 @@ const ContextItem: React.FC<ContextItemProps> = ({ item }) => {
className="my-2 rounded"
/>
)}
<p>{item.description}</p>
<div className="text-sm text-gray-500 mt-2">
<p className="text-black dark:text-white">{item.description}</p>
<div className="text-sm text-gray-500 dark:text-gray-400 mt-2">
{item.provider[0].name} | {new Date(item.datePublished).toLocaleDateString()}
</div>
<a href={item.url} target="_blank" rel="noopener noreferrer" className="text-blue-500 hover:underline">

View file

@ -39,14 +39,14 @@ interface NewsDetailProps {
const NewsDetail: React.FC<NewsDetailProps> = ({ news }) => {
return (
<article className="prose lg:prose-xl">
<h1>{news.title}</h1>
<article className="prose lg:prose-xl dark:prose-invert">
<h1 className="text-black dark:text-white">{news.title}</h1>
{news.sections.map((section, index) => (
<section key={index}>
<h2>{section.title}</h2>
<p>{section.content}</p>
<h2 className="text-black dark:text-white">{section.title}</h2>
<p className="text-black dark:text-white">{section.content}</p>
<div className="mt-4">
<h3>Related Context:</h3>
<h3 className="text-black dark:text-white">Related Context:</h3>
{section.context.map((item, i) => (
<ContextItem key={i} item={item} />
))}