Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit7c9501b

Browse files
committed
Merge branch 'userpage' into dev
2 parents72f54ee +3696d0e commit7c9501b

File tree

34 files changed

+596
-165
lines changed

34 files changed

+596
-165
lines changed

‎components/FocusLine/styles/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const Icon = styled(Img)`
2323
`
2424
exportconstFocus=styled.div`
2525
font-size: 1.1rem;
26-
color:${theme('banner.title')};
26+
color:${theme('contrastFg')};
2727
margin-left: 3px;
2828
margin-right: 3px;
2929
`
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
importReactfrom'react'
2+
import{Button}from'antd'
3+
4+
import{ICON_CMD}from'../../config'
5+
6+
import{BtnWrapper,WatchIcon,LoadingIcon}from'./styles'
7+
8+
constFollowBtn=({ size, loading, onClick})=>{
9+
return(
10+
<React.Fragment>
11+
{loading ?(
12+
<Buttonsize={size}type="primary"ghost>
13+
<BtnWrapper>
14+
<LoadingIconsrc={`${ICON_CMD}/loading_sand.svg`}/>
15+
<div>关注中...</div>
16+
</BtnWrapper>
17+
</Button>
18+
) :(
19+
<Buttonsize={size}type="primary"onClick={onClick}>
20+
<BtnWrapper>
21+
<WatchIconsrc={`${ICON_CMD}/plus_follow.svg`}/>
22+
<div>关 注</div>
23+
</BtnWrapper>
24+
</Button>
25+
)}
26+
</React.Fragment>
27+
)
28+
}
29+
30+
exportdefaultFollowBtn
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
importReactfrom'react'
2+
import{Button}from'antd'
3+
4+
import{ICON_CMD}from'../../config'
5+
importPopoverfrom'../Popover'
6+
7+
import{BtnWrapper,WatchedIcon,Popinfo,LoadingIcon}from'./styles'
8+
9+
constFollowingBtn=({ size, loading, onClick})=>{
10+
return(
11+
<React.Fragment>
12+
{loading ?(
13+
<Buttonsize={size}type="primary">
14+
<BtnWrapper>
15+
<LoadingIconsrc={`${ICON_CMD}/loading_sand.svg`}light/>
16+
<div>取关中...</div>
17+
</BtnWrapper>
18+
</Button>
19+
) :(
20+
<Popover
21+
placement="bottom"
22+
trigger="hover"
23+
content={<Popinfo>点击取消关注</Popinfo>}
24+
>
25+
<Buttonsize={size}type="primary"ghostonClick={onClick}>
26+
<BtnWrapper>
27+
<WatchedIconsrc={`${ICON_CMD}/check2.svg`}/>
28+
<div>已关注</div>
29+
</BtnWrapper>
30+
</Button>
31+
</Popover>
32+
)}
33+
</React.Fragment>
34+
)
35+
}
36+
37+
exportdefaultFollowingBtn

‎components/FollowButton/index.js‎

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
*
3+
* FollowButton
4+
*
5+
*/
6+
7+
importReactfrom'react'
8+
importPropTypesfrom'prop-types'
9+
10+
importFollowingBtnfrom'./FollowingBtn'
11+
importFollowBtnfrom'./FollowBtn'
12+
13+
import{makeDebugger}from'../../utils'
14+
/* eslint-disable no-unused-vars */
15+
constdebug=makeDebugger('c:FollowButton:index')
16+
/* eslint-enable no-unused-vars */
17+
18+
classFollowButtonextendsReact.Component{
19+
state={loading:false}
20+
21+
onFollow(){
22+
const{ userId, onFollow}=this.props
23+
24+
this.fakeLoading()
25+
onFollow(userId)
26+
}
27+
28+
onUndoFollow(){
29+
const{ userId, onUndoFollow}=this.props
30+
31+
this.fakeLoading()
32+
onUndoFollow(userId)
33+
}
34+
35+
fakeLoading(){
36+
this.setState({loading:true})
37+
setTimeout(()=>{
38+
this.setState({loading:false})
39+
},1000)
40+
}
41+
42+
render(){
43+
const{ hasFollowd, size}=this.props
44+
const{ loading}=this.state
45+
46+
return(
47+
<React.Fragment>
48+
{hasFollowd ?(
49+
<FollowingBtn
50+
size={size}
51+
loading={loading}
52+
onClick={this.onUndoFollow.bind(this)}
53+
/>
54+
) :(
55+
<FollowBtn
56+
size={size}
57+
loading={loading}
58+
onClick={this.onFollow.bind(this)}
59+
/>
60+
)}
61+
</React.Fragment>
62+
)
63+
}
64+
}
65+
66+
FollowButton.propTypes={
67+
hasFollowd:PropTypes.bool.isRequired,
68+
userId:PropTypes.string.isRequired,
69+
size:PropTypes.oneOf(['small','default','large']),
70+
onFollow:PropTypes.func,
71+
onUndoFollow:PropTypes.func,
72+
}
73+
74+
FollowButton.defaultProps={
75+
size:'small',
76+
onFollow:debug,
77+
onUndoFollow:debug,
78+
}
79+
80+
exportdefaultFollowButton

‎components/FollowButton/lang.js‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* FollowButton Langs
3+
*
4+
* This contains all the text for the FollowButton component.
5+
*/
6+
import{defineMessages}from'react-intl'
7+
8+
exportdefaultdefineMessages({
9+
header:{
10+
id:'components.FollowButton.header',
11+
defaultMessage:'This is the FollowButton component !',
12+
},
13+
})

‎containers/UserLister/styles/follow_button.js‎renamed to ‎components/FollowButton/styles/index.js‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
importstyledfrom'styled-components'
22

3-
importImgfrom'../../../components/Img'
4-
import{theme}from'../../../utils'
3+
importImgfrom'../../Img'
4+
import{theme,Animate}from'../../../utils'
55

66
exportconstBtnWrapper=styled.div`
77
display: flex;
@@ -14,12 +14,23 @@ const BtnIcon = styled(Img)`
1414
margin-right: 3px;
1515
`
1616
exportconstWatchIcon=styled(BtnIcon)`
17-
fill:${theme('banner.title')};
17+
height: 12px;
18+
width: 12px;
19+
fill:${theme('button.fg')};
1820
`
1921
exportconstWatchedIcon=styled(BtnIcon)`
20-
fill:${theme('button.fg')};
22+
fill:${theme('banner.title')};
2123
`
2224
exportconstPopinfo=styled.div`
2325
color:${theme('thread.articleTitle')};
2426
padding: 5px 8px;
2527
`
28+
29+
exportconstLoadingIcon=styled(BtnIcon)`
30+
fill:${({ light})=>
31+
light ?theme('button.fg') :theme('thread.articleTitle')};
32+
33+
height: 20px;
34+
width: 20px;
35+
animation:${Animate.rotate360} 1s linear infinite;
36+
`
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// import React from 'react'
2+
// import { shallow } from 'enzyme'
3+
4+
// import FollowButton from '../index'
5+
6+
describe('TODO <FollowButton />',()=>{
7+
it('Expect to have unit tests specified',()=>{
8+
expect(true).toEqual(true)
9+
})
10+
})

‎components/Tabber/index.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ const supportIcons = [
2525
'wiki',
2626
'job',
2727
'cheatsheet',
28+
// user tab
29+
'posts',
30+
'settings',
31+
'likes',
32+
'favorites',
2833
]
2934
constTabIcon=({ raw, active})=>{
3035
if(R.contains(raw,supportIcons)){

‎components/UserBrief/styles/index.js‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,31 @@ import { theme } from '../../../utils'
66
exportconstWrapper=styled.div`
77
display: flex;
88
`
9-
109
exportconstAvatarWrapper=styled.div`
1110
margin-right: 12px;
1211
display: flex;
1312
flex-direction: column;
1413
`
15-
1614
exportconstAvatar=styled(Img)`
17-
border-radius:8px;
15+
border-radius:4px;
1816
width:${({ displayStyle})=>
1917
displayStyle==='default' ?'120px' :'70px'};
2018
height:${({ displayStyle})=>
2119
displayStyle==='default' ?'120px' :'70px'};
2220
margin-top: 6px;
2321
margin-bottom: 10px;
2422
`
25-
2623
exportconstBriefTextWrapper=styled.div`
2724
display: flex;
2825
flex-direction: column;
2926
margin-left: 10px;
3027
`
31-
3228
exportconstUserTitle=styled.div`
3329
display: flex;
3430
font-size: 1.2rem;
3531
color:${theme('banner.title')};
3632
margin-bottom: 5px;
3733
`
38-
3934
exportconstUserDesc=styled.div`
4035
color:${theme('banner.desc')};
4136
display:${({ hide})=>(hide ?'none' :'flex')};
@@ -66,7 +61,6 @@ export const DescIconLable = styled(Img)`
6661
margin-right: 10px;
6762
margin-top: 4px;
6863
`
69-
7064
exportconstBackgroundDivider=styled.div`
7165
width: 5px;
7266
height: 5px;
@@ -98,7 +92,6 @@ export const SocialSpliter = styled.div`
9892
exportconstSocialWrapper=styled.div`
9993
display: flex;
10094
`
101-
10295
exportconstSocialIcon=styled(Img)`
10396
fill:${theme('banner.desc')};
10497
display:${({ active})=>(active ?'block' :'none')};
@@ -118,7 +111,6 @@ export const SocialIcon = styled(Img)`
118111
exportconstEditWrapper=styled.div`
119112
display:${({ show})=>(show ?'block' :'none')};
120113
`
121-
122114
exportconstEditIcon=styled(Img)`
123115
fill:${theme('banner.desc')};
124116
width: 20px;

‎components/index.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export { default as GithubRepoPage } from './GithubRepoPage'
4848
export{defaultasGithubUserCard}from'./GithubUserCard'
4949
export{defaultasSearchingLabel}from'./SearchingLabel'
5050
export{defaultasEmptyLabel}from'./EmptyLabel'
51+
export{defaultasFollowButton}from'./FollowButton'
5152

5253
// loading component
5354
export{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp