1- import { BiCommentDetail } from 'react-icons/bi'
21import { GoDotFill } from 'react-icons/go'
32import { MdAccessTime } from 'react-icons/md'
43import { CardItemWithActions , CardLink } from 'src/components/Elements'
54import { Attributes } from 'src/lib/analytics'
65import { useUserPreferences } from 'src/stores/preferences'
7- import { Article , BaseItemPropsType } from 'src/types'
6+ import { BaseItemPropsType , FeedItem } from 'src/types'
87import { format } from 'timeago.js'
98
10- const ArticleItem = ( props : BaseItemPropsType < Article > ) => {
9+ export const ArticleItem = ( props : BaseItemPropsType < FeedItem > ) => {
1110 const { item, index, analyticsTag } = props
1211 const { listingMode } = useUserPreferences ( )
1312
@@ -19,23 +18,22 @@ const ArticleItem = (props: BaseItemPropsType<Article>) => {
1918 key = { index }
2019 cardItem = {
2120 < >
22- < p className = "rowTitle" >
21+ < div className = "rowTitle" >
2322 < CardLink
2423 link = { item . url }
2524 className = "titleWithCover"
2625 analyticsAttributes = { {
27- [ Attributes . POINTS ] : item . reactions ,
2826 [ Attributes . TRIGERED_FROM ] : 'card' ,
2927 [ Attributes . TITLE ] : item . title ,
3028 [ Attributes . LINK ] : item . url ,
3129 [ Attributes . SOURCE ] : analyticsTag ,
3230 } } >
33- { item . image_url && listingMode === 'normal' && (
34- < img src = { item . image_url } className = "rowCover" alt = "" />
31+ { item . image && listingMode === 'normal' && (
32+ < img src = { item . image } className = "rowCover" alt = "" />
3533 ) }
3634 < span className = "subTitle" > { item . title } </ span >
3735 </ CardLink >
38- </ p >
36+ </ div >
3937 { listingMode === 'compact' && (
4038 < div className = "rowDetails" >
4139 < span className = "rowItem capitalize" >
@@ -48,12 +46,8 @@ const ArticleItem = (props: BaseItemPropsType<Article>) => {
4846 < span className = "rowItem capitalize" >
4947 < GoDotFill className = "rowItemIcon" /> { item . source }
5048 </ span >
51- < span className = "rowItem" title = { new Date ( item . published_at ) . toUTCString ( ) } >
52- < MdAccessTime className = "rowItemIcon" /> { format ( new Date ( item . published_at ) ) }
53- </ span >
54- < span className = "rowItem" >
55- < BiCommentDetail className = { 'rowTitleIcon' } />
56- { item . comments } comments
49+ < span className = "rowItem" title = { new Date ( item . date ) . toUTCString ( ) } >
50+ < MdAccessTime className = "rowItemIcon" /> { format ( new Date ( item . date ) ) }
5751 </ span >
5852 </ div >
5953 ) }
0 commit comments