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

Commit 80b397c

Browse files
committed
fix: header & articleBanner align center
1 parent 5052be5 commit 80b397c

File tree

4 files changed

+52
-49
lines changed

4 files changed

+52
-49
lines changed

containers/ArticleBanner/index.js

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ import TimeAgo from 'timeago-react'
1111

1212
import { connectStore, buildLog } from '@utils'
1313

14+
import FavoritesCats from '@containers/FavoritesCats'
1415
import DotDivider from '@components/DotDivider'
1516
import Maybe from '@components/Maybe'
1617
import { Space } from '@components/BaseStyled'
17-
import FavoritesCats from '../FavoritesCats'
1818

1919
import Title from './Title'
2020
import ReactionNumbers from './ReactionNumbers'
2121
import MiddleInfo from './MiddleInfo'
2222

23-
import { Wrapper, BannerContent, Brief, Desc } from './styles'
23+
import { Wrapper, InnerWrapper, BannerContent, Brief, Desc } from './styles'
2424
import { useInit } from './logic'
2525

2626
/* eslint-disable-next-line */
@@ -45,41 +45,43 @@ const ArticleBannerContainer = ({
4545
<Wrapper>
4646
<FavoritesCats />
4747
{!R.isNil(viewingData.id) && (
48-
<BannerContent>
49-
<Brief>
50-
<Title thread={activeThread} data={viewingData} />
51-
<MiddleInfo thread={activeThread} data={viewingData} />
52-
<Desc>
53-
发布于:
54-
<Space left="3px" right="3px" />
55-
<TimeAgo datetime={viewingData.insertedAt} locale="zh_CN" />
56-
<Maybe test={showWordCount}>
57-
<React.Fragment>
58-
<DotDivider />
59-
字数: {viewingData.length}
60-
</React.Fragment>
61-
</Maybe>
62-
<Maybe test={showLastSync}>
63-
<React.Fragment>
64-
<DotDivider />
65-
最后同步:
66-
<Space left="3px" right="3px" />
67-
{viewingData.lastSync ? (
68-
<TimeAgo datetime={viewingData.lastSync} locale="zh_CN" />
69-
) : (
70-
<span>--</span>
71-
)}
72-
</React.Fragment>
73-
</Maybe>
74-
</Desc>
75-
</Brief>
76-
<ReactionNumbers
77-
data={viewingData}
78-
starLoading={starLoading}
79-
favoriteLoading={favoriteLoading}
80-
showStar={showStar}
81-
/>
82-
</BannerContent>
48+
<InnerWrapper>
49+
<BannerContent>
50+
<Brief>
51+
<Title thread={activeThread} data={viewingData} />
52+
<MiddleInfo thread={activeThread} data={viewingData} />
53+
<Desc>
54+
发布于:
55+
<Space left="3px" right="3px" />
56+
<TimeAgo datetime={viewingData.insertedAt} locale="zh_CN" />
57+
<Maybe test={showWordCount}>
58+
<React.Fragment>
59+
<DotDivider />
60+
字数: {viewingData.length}
61+
</React.Fragment>
62+
</Maybe>
63+
<Maybe test={showLastSync}>
64+
<React.Fragment>
65+
<DotDivider />
66+
最后同步:
67+
<Space left="3px" right="3px" />
68+
{viewingData.lastSync ? (
69+
<TimeAgo datetime={viewingData.lastSync} locale="zh_CN" />
70+
) : (
71+
<span>--</span>
72+
)}
73+
</React.Fragment>
74+
</Maybe>
75+
</Desc>
76+
</Brief>
77+
<ReactionNumbers
78+
data={viewingData}
79+
starLoading={starLoading}
80+
favoriteLoading={favoriteLoading}
81+
showStar={showStar}
82+
/>
83+
</BannerContent>
84+
</InnerWrapper>
8385
)}
8486
</Wrapper>
8587
)

containers/ArticleBanner/styles/index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { theme, cs } from '@utils'
44

55
export const Wrapper = styled.nav`
66
${cs.flexColumn('justify-center')};
7-
87
position: relative;
98
background: ${theme('banner.bg')};
109
border-bottom: ${theme('banner.spliter')};
@@ -16,14 +15,19 @@ export const Wrapper = styled.nav`
1615
min-height: 100px;
1716
`};
1817
`
18+
export const InnerWrapper = styled.div`
19+
${cs.flex('justify-center')};
20+
width: 100%;
21+
`
1922
export const BannerContent = styled.div`
2023
${cs.flex()};
21-
margin-left: 8%;
22-
margin-right: 8%;
24+
max-width: ${cs.MAX_CONTENT_WIDTH};
25+
width: 100%;
26+
padding: 0 6vw;
2327
2428
${cs.media.mobile`
25-
margin-left: 4%;
26-
margin-right: 3%;
29+
padding: 0;
30+
padding-right: 10px;
2731
`};
2832
`
2933
export const Brief = styled.div`

containers/Header/styles/header.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ export const Wrapper = styled.header.attrs(props => ({
1616
`
1717
export const InnerWrapper = styled.div`
1818
${cs.flex()};
19-
max-width: ${cs.MEDIA_MAX_WIDTH};
19+
max-width: ${cs.MAX_CONTENT_WIDTH};
20+
padding: 0 6vw;
2021
width: 100%;
2122
height: 33px;
2223
align-items: center;
23-
padding: 0 5vw;
2424
transition: all 0.2s;
2525
2626
${cs.media.mobile`padding-right: 0`};

containers/Header/styles/user_account.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import Img from '@components/Img'
44
import { theme, cs } from '@utils'
55

66
export const Wrapper = styled.div`
7-
margin-right: 20px;
8-
97
${cs.media.mobile`
10-
margin-right: 0;
8+
padding: 0;
9+
padding-right: 10px;
1110
`};
1211
`
13-
1412
export const PopMenu = styled.div`
1513
${cs.flexColumn()};
1614
`
@@ -71,7 +69,6 @@ export const AvatarIcon = styled.img`
7169
width: 20px;
7270
height: 20px;
7371
cursor: pointer;
74-
margin-right: 12px;
7572
border-radius: 3px;
7673
opacity: ${theme('avatarOpacity')};
7774
`

0 commit comments

Comments
 (0)