feat: Modify the layout of news items Add the function of expanding or contracting after clicking on them

This commit is contained in:
Kaiwen Gong 2024-07-18 17:33:59 +08:00
parent 460c523633
commit 0590864b6f
4 changed files with 118 additions and 40 deletions

View file

@ -1,6 +1,6 @@
import React from "react";
import ContextItem from "./ContextItem";
import ExpandableItems from "./ExpandableItems";
interface ContextItemType {
name: string;
url: string;
@ -47,9 +47,7 @@ const NewsDetail: React.FC<NewsDetailProperties> = ({ news }) => {
<p className="text-black dark:text-white">{section.content}</p>
<div className="mt-4">
<h3 className="text-black dark:text-white">Related Context:</h3>
{section.context.map((item, index_) => (
<ContextItem key={index_} item={item} />
))}
<ExpandableItems context={section.context} />
</div>
</section>
))}