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

Commit 4ea1ff9

Browse files
committed
fix(post): content align center
1 parent 1eb2e04 commit 4ea1ff9

File tree

4 files changed

+28
-29
lines changed

4 files changed

+28
-29
lines changed

containers/PostContent/index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ import SideCards from './SideCards'
2222

2323
import {
2424
Wrapper,
25+
InnerWrapper,
2526
MainWrapper,
27+
SidebarWrapper,
2628
ArticleWrapper,
2729
BodyHeaderWrapper,
2830
CommentsWrapper,
@@ -43,7 +45,7 @@ const PostContentContainer = ({ postContent }) => {
4345
return (
4446
<Wrapper>
4547
<Maybe test={viewingData.id}>
46-
<React.Fragment>
48+
<InnerWrapper>
4749
<MainWrapper>
4850
<ArticleWrapper>
4951
<BodyHeaderWrapper>
@@ -68,10 +70,12 @@ const PostContentContainer = ({ postContent }) => {
6870
<Comments ssr />
6971
</CommentsWrapper>
7072
</MainWrapper>
71-
<Affix offsetTop={30}>
72-
<SideCards data={viewingData} />
73-
</Affix>
74-
</React.Fragment>
73+
<SidebarWrapper>
74+
<Affix offsetTop={30}>
75+
<SideCards data={viewingData} />
76+
</Affix>
77+
</SidebarWrapper>
78+
</InnerWrapper>
7579
</Maybe>
7680
</Wrapper>
7781
)

containers/PostContent/styles/index.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,33 @@ import styled from 'styled-components'
33
import { theme, cs } from '@utils'
44

55
export const Wrapper = styled.article`
6-
${cs.flex()};
7-
padding: 20px;
6+
${cs.flex('justify-center')};
7+
padding-top: 20px;
88
min-height: 300px;
9+
910
${cs.media.tablet`
1011
padding: 8px 0;
1112
`};
1213
`
14+
export const InnerWrapper = styled.div`
15+
${cs.flex()};
16+
width: 100%;
17+
max-width: ${cs.MAX_CONTENT_WIDTH};
18+
padding: 0 6vw;
19+
${cs.media.desktop`
20+
padding: 0 4vw;
21+
`};
22+
`
1323
export const MainWrapper = styled.div`
14-
width: 68%;
15-
margin-left: 2.5rem;
1624
${cs.media.tablet`
1725
width: 100%;
18-
margin-left: 0;
1926
`};
2027
`
28+
export const SidebarWrapper = styled.div``
2129

2230
/* background: ${theme('preview.articleBg')}; */
2331
export const ArticleWrapper = styled.div`
2432
font-size: 1.1rem;
25-
margin-left: 2vw;
2633
margin-right: 1.6vw;
2734
background: ${theme('preview.articleBg')};
2835
border-radius: 5px;
@@ -41,11 +48,12 @@ export const BodyHeaderWrapper = styled.div`
4148
`
4249

4350
export const CommentsWrapper = styled.div`
44-
margin-top: 30px;
45-
margin: 25px;
51+
margin: 30px 0;
52+
margin-right: 25px;
53+
4654
${cs.media.mobile`
47-
margin: 10px;
48-
`};
55+
margin: 10px;
56+
`};
4957
`
5058

5159
export const MobileWrapper = styled.div`

containers/PostsThread/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ import CityList from './CityList'
2424

2525
import {
2626
Wrapper,
27-
LeftPadding,
28-
RightPadding,
2927
LeftPart,
3028
RightPart,
3129
FilterWrapper,
@@ -99,7 +97,6 @@ const PostsThreadContainer = ({ postsThread }) => {
9997

10098
return (
10199
<Wrapper>
102-
<LeftPadding />
103100
{isSpecThread(curCommunity.raw, curThread) ? (
104101
<SpecThread
105102
community={curCommunity.raw}
@@ -158,8 +155,6 @@ const PostsThreadContainer = ({ postsThread }) => {
158155
</RightPart>
159156
</React.Fragment>
160157
)}
161-
162-
<RightPadding />
163158
</Wrapper>
164159
)
165160
}

containers/PostsThread/styles/index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,15 @@ import { cs } from '@utils'
66

77
export const Wrapper = styled.div`
88
${cs.flex()};
9-
max-width: 1400px;
109
padding-top: 8px;
1110
width: 100%;
1211
`
13-
14-
export const LeftPadding = styled.div`
15-
width: 3vw;
16-
`
17-
export const RightPadding = styled.div`
18-
width: 4vw;
19-
`
2012
export const LeftPart = styled.div`
2113
flex-grow: 1;
2214
width: 100%;
2315
`
2416
export const RightPart = styled.div`
25-
width: 18vw;
17+
min-width: 200px;
2618
margin-left: 30px;
2719
padding-top: 5px;
2820
${cs.media.tablet`display: none;`};

0 commit comments

Comments
 (0)