Skip to content

Commit 440ab03

Browse files
committed
feat: add top tag to list
1 parent 3405109 commit 440ab03

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/constants/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const TABS_MAP = {
1111
},
1212
ask: {
1313
name: '问答',
14-
color: '#5BD8A6',
14+
color: '#999',
1515
},
1616
job: {
1717
name: '招聘',

src/page/topic/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ const TopicList: React.FC<Props> = (props) => {
9898
avatar: {
9999
dataIndex: 'author.avatar_url',
100100
render: (_, entity) => {
101-
const { tab: _tab, author, reply_count, visit_count } = entity;
101+
const { tab: _tab, author, reply_count, visit_count, top } = entity;
102102

103-
const category = TABS_MAP[_tab as keyof typeof TABS_MAP] || {
103+
const category = TABS_MAP[_tab as TabType] || {
104104
color: '#777',
105105
name: '未知',
106106
};
@@ -123,7 +123,11 @@ const TopicList: React.FC<Props> = (props) => {
123123
</span>
124124
/<span>{visit_count}</span>
125125
</div>
126-
<Tag color={category.color}>{category.name}</Tag>
126+
{top ? (
127+
<Tag color="#5BD8A6">置顶</Tag>
128+
) : (
129+
<Tag color={category.color}>{category.name}</Tag>
130+
)}
127131
</Space>
128132
);
129133
},

0 commit comments

Comments
 (0)