Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 4bc6b4a

Browse files
committed
style(media-query): improve comments list
1 parent c7796ce commit 4bc6b4a

File tree

2 files changed

+43
-21
lines changed

2 files changed

+43
-21
lines changed

containers/Comments/CommentsList.js

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import {
3333
CommentUserInfo,
3434
CommentAvatar,
3535
CommentHeader,
36+
MobileAvatar,
37+
HeaderBaseInfo,
3638
CommentUserName,
3739
TimeStamps,
3840
CommentContent,
@@ -120,25 +122,30 @@ const Comment = ({ data, tobeDeleteId, accountInfo }) => (
120122

121123
<CommentBodyInfo onMouseUp={getSelection}>
122124
<CommentHeader>
123-
<CommentHeaderFirst>
124-
<CommentUserName>
125-
{data.author.nickname}
126-
<FloorNum>#{data.floor}</FloorNum>
127-
</CommentUserName>
128-
{data.repliesCount !== 0 && (
129-
<ReplyUsers>
130-
<ReplyTitle>收到回复:</ReplyTitle>
131-
<AvatarsRow
132-
users={getAuthors(data)}
133-
onUserSelect={logic.previewReply}
134-
total={data.repliesCount}
135-
/>
136-
</ReplyUsers>
137-
)}
138-
</CommentHeaderFirst>
139-
<TimeStamps>
140-
<TimeAgo datetime={data.insertedAt} locale="zh_CN" />
141-
</TimeStamps>
125+
<MobileAvatar>
126+
<CommentAvatar src={data.author.avatar} />
127+
</MobileAvatar>
128+
<HeaderBaseInfo>
129+
<CommentHeaderFirst>
130+
<CommentUserName>
131+
{data.author.nickname}
132+
<FloorNum>#{data.floor}</FloorNum>
133+
</CommentUserName>
134+
{data.repliesCount !== 0 && (
135+
<ReplyUsers>
136+
<ReplyTitle>收到回复:</ReplyTitle>
137+
<AvatarsRow
138+
users={getAuthors(data)}
139+
onUserSelect={logic.previewReply}
140+
total={data.repliesCount}
141+
/>
142+
</ReplyUsers>
143+
)}
144+
</CommentHeaderFirst>
145+
<TimeStamps>
146+
<TimeAgo datetime={data.insertedAt} locale="zh_CN" />
147+
</TimeStamps>
148+
</HeaderBaseInfo>
142149
</CommentHeader>
143150
<CommentContent>
144151
{data.replyTo && (

containers/Comments/styles/comments_list.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,31 @@ export const DeleteBtnGroup = styled.div`
8383
`
8484
export const CommentUserInfo = styled.div`
8585
margin-right: 15px;
86+
${cs.media.mobile`display: none`};
8687
`
8788
export const CommentAvatar = styled(Img)`
8889
${cs.circle('38px')};
8990
opacity: ${theme('avatarOpacity')};
9091
`
9192
export const CommentHeader = styled.div`
92-
${cs.flexColumn()};
93+
${cs.flex()};
9394
margin-bottom: 5px;
9495
margin-top: -1px;
9596
`
97+
98+
export const MobileAvatar = styled.div`
99+
display: none;
100+
${cs.media.mobile`
101+
display: block;
102+
margin-top: 3px;
103+
margin-right: 10px;
104+
`};
105+
`
106+
107+
export const HeaderBaseInfo = styled.div`
108+
${cs.flexColumn()};
109+
`
110+
96111
export const CommentHeaderFirst = styled.div`
97112
${cs.flex()};
98113
`
@@ -114,7 +129,7 @@ export const CommentContent = styled.div`
114129
font-size: 0.9rem;
115130
116131
${cs.media.mobile`
117-
max-width: 250px;
132+
max-width: 280px;
118133
`};
119134
`
120135
export const CommentFooter = styled.div`

0 commit comments

Comments
 (0)