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

Commit 1baca4a

Browse files
committed
style: postItem with community label & adjust looks
1 parent 69a7d1b commit 1baca4a

File tree

8 files changed

+40
-9
lines changed

8 files changed

+40
-9
lines changed

src/components/AvatarsRow/styles/more_item.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const Wrapper = styled(BaseAvatarItem)`
2626

2727
type TNumbersMore = { size: string; total: number }
2828
export const NumbersMore = styled(AvatarsMore)<TNumbersMore>`
29+
background: #123d4c;
2930
color: ${theme('thread.articleTitle')};
3031
height: ${({ size }) => getAvatarSize(size)};
3132
width: ${({ total }) => getMoreTextWidth(total)};

src/components/PostItem/DigestView/DesktopView/ActiveBadge.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@ type TProps = {
1010
}
1111

1212
const ActiveBadge: FC<TProps> = ({ item }) => {
13+
const isArchived = item.commentsCount === 24
14+
const path = isArchived ? 'article/archived.svg' : 'shape/activity.svg'
15+
1316
return (
1417
<Wrapper hasComments={item.commentsCount > 0}>
1518
<IconButton
16-
path="shape/activity.svg"
19+
path={path}
1720
size={14}
1821
hint={<Hint>最后回复: 2020-03-11 14:33</Hint>}
1922
mRight={6}
2023
hintPlacement="bottom"
2124
hintDelay={0}
2225
/>
23-
4天前
26+
<div>4天前</div>
2427
</Wrapper>
2528
)
2629
}

src/components/PostItem/DigestView/DesktopView/Body.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
PublishTime,
1818
Extra,
1919
LeftPart,
20+
CommunityLabel,
2021
AuthorName,
2122
ItemWrapper,
2223
ViewsIcon,
@@ -31,6 +32,8 @@ const Body: FC<TProps> = ({ item }) => {
3132
<Wrapper>
3233
<Extra>
3334
<LeftPart>
35+
<CommunityLabel>Elixir</CommunityLabel>
36+
<Dot radius={3} space={8} />
3437
<AuthorName>{item.author.nickname}</AuthorName>
3538
<Dot radius={3} space={8} />
3639
<PublishTime>

src/components/PostItem/DigestView/DesktopView/Header.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
Brief,
1717
Title,
1818
TagListWrapper,
19+
Participants,
1920
} from '../../styles/digest_view/header'
2021

2122
type TProps = {
@@ -39,10 +40,12 @@ const Header: FC<TProps> = ({ item }) => {
3940
<InlineTags data={item.tags} />
4041
</TagListWrapper>
4142
</Brief>
42-
<AvatarsRow
43-
users={item.commentsParticipators}
44-
total={item.commentsCount}
45-
/>
43+
<Participants>
44+
<AvatarsRow
45+
users={item.commentsParticipators}
46+
total={item.commentsCount}
47+
/>
48+
</Participants>
4649
</Wrapper>
4750
)
4851
}

src/components/PostItem/styles/digest_view/active_badge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const Wrapper = styled.div<{ hasComments: boolean }>`
1111
top: 6px;
1212
right: 0;
1313
color: ${theme('thread.articleTitle')};
14-
margin-right: 6px;
14+
margin-right: 1px;
1515
margin-top: 8px;
1616
1717
${Main}:hover & {

src/components/PostItem/styles/digest_view/body.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@ export const Extra = styled.li`
2222
export const LeftPart = styled.div`
2323
${css.flex('align-center')};
2424
`
25+
26+
export const CommunityLabel = styled.div`
27+
padding-left: 14px;
28+
position: relative;
29+
font-weight: bold;
30+
31+
&:before {
32+
content: '';
33+
position: absolute;
34+
left: 1px;
35+
top: 4px;
36+
width: 6px;
37+
height: 10px;
38+
border-radius: 4px;
39+
background-color: #49a5a0;
40+
}
41+
`
2542
export const AuthorName = styled.div`
2643
color: ${theme('thread.extraInfo')};
2744
font-size: 13px;

src/components/PostItem/styles/digest_view/header.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ export const LinkIcon = styled(Img)`
5050
${css.size(12)};
5151
`
5252
export const TagListWrapper = styled.div``
53+
54+
export const Participants = styled.div`
55+
margin-top: 2px;
56+
`

src/components/PostItem/styles/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export const Wrapper = styled.article<TWrapper>`
1717
position: relative;
1818
opacity: ${({ entry, activeId, c11n }) => getOpacity(entry, activeId, c11n)};
1919
20-
padding-top: ${({ c11n }) => (c11n.contentDivider ? '10px' : '6px')};
21-
padding-bottom: ${({ c11n }) => (c11n.contentDivider ? '10px' : '6px')};
20+
padding-top: ${({ c11n }) => (c11n.contentDivider ? '10px' : '8px')};
21+
padding-bottom: ${({ c11n }) => (c11n.contentDivider ? '14px' : '8px')};
2222
border-bottom: ${({ c11n }) => (c11n.contentDivider ? '1px solid' : '0')};
2323
border-bottom-color: ${theme('thread.articleDivider')};
2424

0 commit comments

Comments
 (0)