Skip to content

Commit 8291a79

Browse files
committed
[fix]bug
1 parent a317097 commit 8291a79

File tree

3 files changed

+67
-44
lines changed

3 files changed

+67
-44
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"react-redux": "^7.2.4",
6161
"react-router-dom": "^6.3.0",
6262
"tdesign-icons-react": "^0.4.3",
63-
"tdesign-react": "^1.10.4",
63+
"tdesign-react": "^1.12.1",
6464
"tvision-color": "^1.5.0",
6565
"uuid": "^11.0.5"
6666
},

src/pages/Detail/Secondary/index.module.less

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,37 @@
77
.listItem {
88
cursor: pointer;
99
padding: 13px 24px 13px 0;
10+
display: flex;
11+
flex-direction: column;
12+
position: relative;
13+
1014
&:hover {
1115
background-color: var(--td-bg-color-container-hover);
1216
}
17+
1318
&:hover .createTime {
1419
display: none;
1520
}
21+
22+
.createTime {
23+
position: absolute;
24+
right: 24px;
25+
top: 50%;
26+
transform: translateY(-50%);
27+
}
28+
1629
.action {
1730
display: none;
31+
position: absolute;
32+
right: 24px;
33+
top: 50%;
34+
transform: translateY(-50%);
1835
}
36+
1937
&:hover .action {
2038
display: block;
2139
}
40+
2241
&:after {
2342
content: "";
2443
position: absolute;
@@ -29,6 +48,7 @@
2948
background: var(--td-border-level-1-color);
3049
}
3150
}
51+
3252
.content {
3353
margin: 0;
3454
font-size: 14px;
@@ -38,15 +58,19 @@
3858
overflow: hidden;
3959
text-overflow: ellipsis;
4060
white-space: nowrap;
61+
padding-right: 120px; /* Make room for the action buttons */
4162
}
63+
4264
.tag {
4365
margin-right: 8px;
4466
}
67+
4568
.noData {
4669
text-align: center;
4770
height: 28px;
4871
line-height: 28px;
4972
}
73+
5074
.unread {
5175
color: var(--td-brand-color-8);
5276
}

src/pages/Detail/Secondary/index.tsx

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -26,50 +26,49 @@ const MsgList = memo((props: IMsgListProps) => {
2626
const { list, onUpdate, onDelete } = props;
2727
return (
2828
<List className={Style.msgList}>
29-
{list?.map((item) => (
30-
<ListItem
31-
className={Style.listItem}
32-
key={item.id}
33-
action={
34-
<li>
35-
<div className={Style.createTime}>{item.createTime}</div>
36-
<div className={Style.action}>
37-
<Row gutter={8}>
38-
<Col>
39-
{item.status === 1 && (
40-
<Popup trigger='hover' showArrow content='设为已读'>
41-
<AddRectangleIcon onClick={() => onUpdate(item, 2)} />
42-
</Popup>
43-
)}
44-
{item.status === 2 && (
45-
<Popup trigger='hover' showArrow content='设为未读'>
46-
<ChatIcon onClick={() => onUpdate(item, 1)} />
47-
</Popup>
48-
)}
49-
</Col>
50-
<Col>
51-
<Popup trigger='hover' showArrow content='删除通知'>
52-
<DeleteIcon onClick={() => onDelete(item)} />
53-
</Popup>
54-
</Col>
55-
</Row>
56-
</div>
57-
</li>
58-
}
59-
>
60-
<div
61-
className={classnames(Style.content, {
62-
[Style.unread]: item.status === 1,
63-
})}
29+
{list && list.length > 0 ? (
30+
list.map((item) => (
31+
<ListItem
32+
className={Style.listItem}
33+
key={item.id}
6434
>
65-
<Tag variant='light' theme={typeMap[item.type]} className={Style.tag}>
66-
{item.tag}
67-
</Tag>
68-
{item.content}
69-
</div>
70-
</ListItem>
71-
))}
72-
{list.length === 0 && <div className={Style.noData}>暂无数据</div>}
35+
<div
36+
className={classnames(Style.content, {
37+
[Style.unread]: item.status === 1,
38+
})}
39+
>
40+
<Tag variant='light' theme={typeMap[item.type]} className={Style.tag}>
41+
{item.tag}
42+
</Tag>
43+
{item.content}
44+
</div>
45+
<div className={Style.createTime}>{item.createTime}</div>
46+
<div className={Style.action}>
47+
<Row gutter={8}>
48+
<Col>
49+
{item.status === 1 && (
50+
<Popup trigger='hover' showArrow content='设为已读'>
51+
<AddRectangleIcon onClick={() => onUpdate(item, 2)} />
52+
</Popup>
53+
)}
54+
{item.status === 2 && (
55+
<Popup trigger='hover' showArrow content='设为未读'>
56+
<ChatIcon onClick={() => onUpdate(item, 1)} />
57+
</Popup>
58+
)}
59+
</Col>
60+
<Col>
61+
<Popup trigger='hover' showArrow content='删除通知'>
62+
<DeleteIcon onClick={() => onDelete(item)} />
63+
</Popup>
64+
</Col>
65+
</Row>
66+
</div>
67+
</ListItem>
68+
))
69+
) : (
70+
<div className={Style.noData}>暂无数据</div>
71+
)}
7372
</List>
7473
);
7574
});

0 commit comments

Comments
 (0)