Skip to content

Commit 7111896

Browse files
committed
chore: update style
1 parent 94ff0d4 commit 7111896

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

src/App.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,20 @@
6969
}
7070

7171
#comment-search-root .comment-item-avatar {
72-
width: 40px;
73-
height: 40px;
7472
border-radius: 50%;
7573
background-color: var(--Ga1);
7674
margin-right: 10px;
7775
}
7876

7977
#comment-search-root .comment-item-content {
80-
display: flex;
81-
flex-direction: column;
8278
}
8379

8480
#comment-search-root .comment-item-username {
8581
font-size: 12px;
8682
font-weight: bold;
8783
margin-bottom: 4px;
8884
color: #61666d;
85+
margin-right: 12px;
8986
}
9087

9188
#comment-search-root .comment-item-message {

src/App.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,38 @@ export default function App() {
5050

5151
interface CommentProps {
5252
comments?: Reply[]
53+
sub?: boolean
5354
}
54-
const CommentTree: React.FC<CommentProps> = ({ comments }) => {
55+
const CommentTree: React.FC<CommentProps> = ({ comments, sub = false }) => {
5556
if (!comments) return null
5657
return (
5758
<ul>
5859
{comments?.map((comment) => (
5960
<li key={comment.rpid} className='comment-item'>
60-
<img src={comment.member.avatar} className='comment-item-avatar' />
61-
<div className='comment-item-content'>
61+
<img
62+
src={comment.member.avatar}
63+
className='comment-item-avatar'
64+
style={{
65+
width: sub ? '30px' : '40px',
66+
height: sub ? '30px' : '40px',
67+
}}
68+
/>
69+
<div
70+
className='comment-item-content'
71+
style={{
72+
...(!sub && {
73+
display: 'flex',
74+
flexDirection: 'column',
75+
}),
76+
}}
77+
>
6278
<span className='comment-item-username'>
6379
{comment.member.uname}
6480
</span>
6581
<span className='comment-item-message'>
6682
{comment.content.message}
6783
</span>
68-
<CommentTree comments={comment.replies} />
84+
<CommentTree comments={comment.replies} sub />
6985
</div>
7086
</li>
7187
))}

0 commit comments

Comments
 (0)