1- import { TABS_MAP , TabType } from '@/constants' ;
2- import ProList , { ProListMetas } from '@ant-design/pro-list' ;
3- import { Space , Avatar , Tag } from 'antd' ;
41import React from 'react' ;
52import dayjs from 'dayjs' ;
63import { useHistory } from 'umi' ;
4+ import { Space , Avatar , Tag } from 'antd' ;
75import { ListToolBarProps } from '@ant-design/pro-table' ;
6+ import ProList , { ProListMetas } from '@ant-design/pro-list' ;
7+
8+ import { TABS_MAP , TabType } from '@/constants' ;
9+
810import * as styles from './index.less' ;
911
10- const TopicItemList : React . FC < Props > = ( { dataSource, loading, toolbar } ) => {
12+ const TopicList : React . FC < Props > = ( { dataSource, loading, toolbar } ) => {
1113 const history = useHistory ( ) ;
1214
1315 const metas : ProListMetas = {
1416 avatar : {
1517 dataIndex : 'author.avatar_url' ,
16- render : ( _ , entity ) => {
18+ render : ( _ , entity : TopicModel ) => {
1719 const { tab : _tab , author, reply_count, visit_count, top } = entity ;
1820
1921 const category = TABS_MAP [ _tab as TabType ] ;
@@ -55,7 +57,7 @@ const TopicItemList: React.FC<Props> = ({ dataSource, loading, toolbar }) => {
5557 valueType : 'text' ,
5658 } ,
5759 actions : {
58- render : ( _ , entity ) => {
60+ render : ( _ , entity : TopicModel ) => {
5961 const { last_reply_at } = entity ;
6062 return dayjs ( last_reply_at ) . fromNow ( ) ;
6163 } ,
@@ -82,10 +84,10 @@ const TopicItemList: React.FC<Props> = ({ dataSource, loading, toolbar }) => {
8284 ) ;
8385} ;
8486
85- export default TopicItemList ;
87+ export default TopicList ;
8688
8789interface Props {
88- dataSource ?: any [ ] ;
90+ dataSource ?: TopicModel [ ] ;
8991 loading ?: boolean ;
9092 toolbar ?: ListToolBarProps ;
9193}
0 commit comments