Skip to content

Commit 0aa0930

Browse files
T3C-246 addeed summaries to topic ui (#318)
1 parent 8db038e commit 0aa0930

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

next-client/src/components/topic/Topic.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ const TopicCard = forwardRef<HTMLDivElement, TopicCardProps>(function TopicCard(
5858
) {
5959
const { topicNode } = useContext(TopicContext);
6060
const { title, description, summary } = topicNode.data;
61-
6261
return (
6362
<Card data-testid={"topic-item"}>
6463
<CardContent ref={ref}>
@@ -77,6 +76,7 @@ const TopicCard = forwardRef<HTMLDivElement, TopicCardProps>(function TopicCard(
7776
</TopicInteractiveGraphic>
7877
</Col>
7978
</CardContent>
79+
{summary && topicNode.isOpen && <TopicSummary summary={summary} />}
8080
<ExpandTopic />
8181
</Card>
8282
);
@@ -120,6 +120,15 @@ export function TopicContextDescription({
120120
);
121121
}
122122

123+
export function TopicSummary({ summary }: { summary: string }) {
124+
return (
125+
<Col gap={2} className="px-4 sm:px-8 pb-6">
126+
<h5>Summary</h5>
127+
<p>{summary}</p>
128+
</Col>
129+
);
130+
}
131+
123132
/**
124133
* Both the claim-cells and the subtopic list. Together here since they interact with one another.
125134
* ! Can probably be refactored to be simpler.
@@ -266,7 +275,7 @@ function ExpandTopic() {
266275
const { isOpen, pagination, children: subtopicNodes, data } = topicNode;
267276

268277
return (
269-
<>
278+
<Col>
270279
{isOpen && data.context ? (
271280
<TopicContextDescription context={data.context} />
272281
) : (
@@ -290,7 +299,7 @@ function ExpandTopic() {
290299
/>
291300
</>
292301
)}
293-
</>
302+
</Col>
294303
);
295304
}
296305

0 commit comments

Comments
 (0)