11import { Link } from '@inertiajs/react'
22import { Topic } from '../types'
33import Avatar from './Avatar'
4+ import TrendingIcon from './TrendingIcon' ;
45
5- function TopicRow ( { topic } : { topic : Topic } ) {
6+ function TopicRow ( { topic, isTrending } : { topic : Topic , isTrending ?: boolean } ) {
67 const {
78 id,
89 title,
@@ -23,6 +24,7 @@ function TopicRow({ topic }: { topic: Topic }) {
2324 < td className = "px-6 py-4" >
2425 < Link href = { `/topics/${ id } ` } className = "text-sm font-medium text-sky-700" >
2526 { title }
27+ { isTrending && < TrendingIcon className = "mx-1" /> }
2628 </ Link >
2729 < br />
2830 < span className = "text-sm text-gray-500 mt-1" > { categoryName } </ span >
@@ -44,7 +46,7 @@ function TopicRow({ topic }: { topic: Topic }) {
4446 )
4547}
4648
47- export default function TopicsTable ( { topics } : { topics : Topic [ ] } ) {
49+ export default function TopicsTable ( { topics, trendingTopics = [ ] } : { topics : Topic [ ] , trendingTopics ?: number [ ] } ) {
4850 return (
4951 < table className = "min-w-full divide-y divide-gray-200" >
5052 < thead className = "bg-gray-50" >
@@ -65,7 +67,7 @@ export default function TopicsTable({ topics }: { topics: Topic[] }) {
6567 </ thead >
6668 < tbody className = "bg-white divide-y divide-gray-200" >
6769 { topics . map ( ( topic : Topic ) => (
68- < TopicRow key = { topic . id } topic = { topic } />
70+ < TopicRow key = { topic . id } topic = { topic } isTrending = { trendingTopics . includes ( topic . id ) } />
6971 ) ) }
7072 { topics . length === 0 && (
7173 < tr >
0 commit comments