blob: 178e5bc64a950e2461644f868685e220ae2e45b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import { ExpandableWidget, List } from '@components/WidgetParts';
import { t } from '@lingui/macro';
import { TopicPreview } from '@ts/types/taxonomies';
import Link from 'next/link';
const RelatedTopics = ({ topics }: { topics: TopicPreview[] }) => {
const sortedTopics = [...topics].sort((a, b) =>
a.title.localeCompare(b.title)
);
const topicsList = sortedTopics.map((topic) => {
return (
<li key={topic.databaseId}>
<Link href={`/sujet/${topic.slug}`}>
<a>{topic.title}</a>
</Link>
</li>
);
});
return (
<ExpandableWidget
title={topicsList.length > 1 ? t`Related topics` : t`Related topic`}
withBorders={true}
>
<List items={topicsList} />
</ExpandableWidget>
);
};
export default RelatedTopics;
|