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

Commit a676c6a

Browse files
committed
style(mobile): improve style & preview link
1 parent 61bd2e5 commit a676c6a

File tree

7 files changed

+44
-8
lines changed

7 files changed

+44
-8
lines changed

components/CommunityStatesPad/styles/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ export const NumberItem = styled.div`
4949
animation: ${animate.pulseRule};
5050
cursor: ${({ readOnly }) => (readOnly ? '' : 'pointer')};
5151
}
52+
53+
${cs.media.mobile`font-size: 1.2rem;`};
5254
`
5355
export const NumberDivider = styled.div`
5456
border: 1px solid;

components/PostItem/DigestView.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
SecondHalf,
1919
CommentsDiget,
2020
BodyDigest,
21+
PublishLable,
2122
Extra,
2223
TagListWrapper,
2324
} from './styles'
@@ -62,9 +63,9 @@ const DigestView = ({ entry, cover, onPreview, onUserSelect }) => (
6263
<Extra>
6364
{entry.author.nickname}
6465
{entry.copyRight === 'original' ? (
65-
<span>&nbsp;发布于:</span>
66+
<PublishLable>&nbsp;发布于:</PublishLable>
6667
) : (
67-
<span>&nbsp;搬运于:</span>
68+
<PublishLable>&nbsp;搬运于:</PublishLable>
6869
)}
6970
<TimeAgo datetime={entry.insertedAt} locale="zh_CN" /> ⁝ 浏览:{' '}
7071
{entry.views}

components/PostItem/styles/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ export const BodyDigest = styled.li`
107107
font-size: 0.85rem;
108108
109109
${cs.media.mobile`
110-
${cs.truncate('350px')};
111-
`};
110+
${cs.truncate('250px')};
111+
`};
112112
`
113113
export const CommentWrapper = styled.div`
114114
${cs.flex('align-center')};
@@ -126,3 +126,11 @@ export const CommentNum = styled.div`
126126
font-size: 0.9rem;
127127
`
128128
export const TagListWrapper = styled.div``
129+
130+
export const PublishLable = styled.span`
131+
display: inline;
132+
${cs.media.mobile`
133+
display: none;
134+
margin-left: 3px;
135+
`};
136+
`

containers/CommunityBanner/styles/digest_view.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const BaseBannerContent = styled.div`
2222
margin-top: -2rem;
2323
${cs.media.mobile`
2424
margin-left: 0;
25-
margin-right: 0;
25+
margin-right: 3%;
2626
padding-left: 3%;
2727
padding-right: 3%;
2828
`};
@@ -99,7 +99,7 @@ export const Desc = styled.div`
9999
@media (max-height: 800px) {
100100
font-size: 1rem;
101101
}
102-
${cs.truncate('250px')};
102+
${cs.truncate('180px')};
103103
`
104104
export const LogoHolder = styled(Img)`
105105
fill: ${theme('banner.desc')};

containers/Preview/logic.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {
66
holdPage,
77
unholdPage,
88
dispatchEvent,
9+
Global,
10+
cs,
911
} from 'utils'
1012
import SR71 from 'utils/async/sr71'
1113

@@ -42,8 +44,21 @@ const DataResolver = [
4244
match: asyncRes(EVENT.PREVIEW_OPEN),
4345
action: res => {
4446
const payload = res[EVENT.PREVIEW_OPEN]
45-
holdPage()
4647

48+
/*
49+
debug('should open payload thread: ', payload.thread)
50+
debug('should open payload id: ', payload.data.id)
51+
debug('payload curCommunity: ', store.curCommunity.raw)
52+
*/
53+
Global.innerWidth <= cs.mediaBreakPoints.mobile
54+
if (Global.innerWidth <= cs.mediaBreakPoints.mobile) {
55+
const { thread, data } = payload
56+
const targetUrl = `/${store.curCommunity.raw}/${thread}/${data.id}`
57+
Global.location.href = targetUrl
58+
return false
59+
}
60+
61+
holdPage()
4762
store.open(payload)
4863
},
4964
},

containers/Preview/store.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ const PreviewStore = t
8989
get root() {
9090
return getParent(self)
9191
},
92+
get curCommunity() {
93+
return stripMobx(self.root.viewing.community)
94+
},
9295
get curTheme() {
9396
return self.root.theme.curTheme
9497
},
@@ -98,7 +101,6 @@ const PreviewStore = t
98101
get attUserData() {
99102
return stripMobx(self.attUser)
100103
},
101-
102104
get modalVisible() {
103105
return self.visible && Global.innerWidth > cs.mediaBreakPoints.desktop
104106
},

containers/ThemeWrapper/GlobalStyle.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ import { createGlobalStyle } from 'styled-components'
22
import { theme, cs } from 'utils'
33
import normalize from './normalize'
44

5+
/*
6+
body {
7+
${cs.media.mobile`
8+
position: fixed;
9+
`};
10+
}
11+
*/
12+
513
const GlobalStyle = createGlobalStyle`
614
${normalize};
715
html {

0 commit comments

Comments
 (0)