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

Commit e855975

Browse files
committed
refactor(clean up): rm antd tooltip in communities page
1 parent 3c811e8 commit e855975

File tree

4 files changed

+83
-25
lines changed

4 files changed

+83
-25
lines changed

components/AvatarsRow/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import React from 'react'
88
import T from 'prop-types'
99
import R from 'ramda'
10-
// import { Tooltip } from 'antd'
1110

1211
import { ATATARS_LIST_LENGTH } from '@config/general'
1312
import { buildLog, prettyNum } from '@utils'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react'
2+
3+
// import { ICON_CMD } from 'config'
4+
import { Wrapper, Title, Desc } from './styles/hinter'
5+
6+
const Hinter = ({ title, desc }) => (
7+
<Wrapper>
8+
<Title>{title}</Title>
9+
<Desc>{desc}</Desc>
10+
</Wrapper>
11+
)
12+
13+
export default Hinter

containers/CommunitiesContent/SubscribeBtn.js

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,41 @@
11
import React from 'react'
2-
import { Button, Tooltip } from 'antd'
2+
import { Button } from 'antd'
33

44
import { ICON_CMD } from '@config'
55

6+
import Tooltip from '@components/Tooltip'
7+
import Hinter from './Hinter'
8+
69
import { SubscribedBox, BtnWrapper, PrefixIcon } from './styles'
710
import { subscribe, unSubscribe } from './logic'
811

912
const AlreadySubedBtn = ({ community }) => (
10-
<Tooltip title="取消关注" mouseEnterDelay={1} placement="bottom">
13+
<React.Fragment>
1114
{community.raw !== 'home' ? (
12-
<Button
13-
size="small"
14-
type="primary"
15-
ghost
16-
onClick={unSubscribe.bind(this, community.id)}
15+
<Tooltip
16+
content={
17+
<Hinter
18+
title="取消关注"
19+
desc="之后该社区将不会出现在左侧订阅列表中"
20+
/>
21+
}
22+
animation="perspective"
23+
delay={1000}
1724
>
18-
<BtnWrapper>
19-
<PrefixIcon src={`${ICON_CMD}/check2.svg`} primary />
20-
<div>已关注</div>
21-
</BtnWrapper>
22-
</Button>
25+
<div>
26+
<Button
27+
size="small"
28+
type="primary"
29+
ghost
30+
onClick={unSubscribe.bind(this, community.id)}
31+
>
32+
<BtnWrapper>
33+
<PrefixIcon src={`${ICON_CMD}/check2.svg`} primary />
34+
<div>已关注</div>
35+
</BtnWrapper>
36+
</Button>
37+
</div>
38+
</Tooltip>
2339
) : (
2440
<SubscribedBox>
2541
<BtnWrapper>
@@ -28,7 +44,7 @@ const AlreadySubedBtn = ({ community }) => (
2844
</BtnWrapper>
2945
</SubscribedBox>
3046
)}
31-
</Tooltip>
47+
</React.Fragment>
3248
)
3349

3450
const SubscribeBtn = ({
@@ -43,22 +59,32 @@ const SubscribeBtn = ({
4359
)
4460
}
4561
return (
46-
<div>
62+
<React.Fragment>
4763
{community.viewerHasSubscribed ? (
4864
<AlreadySubedBtn community={community} />
4965
) : (
50-
<Button
51-
size="small"
52-
type="primary"
53-
onClick={subscribe.bind(this, community.id)}
66+
<Tooltip
67+
content={
68+
<Hinter title="关注" desc="之后该社区将会出现在左侧订阅列表中" />
69+
}
70+
animation="perspective"
71+
delay={1000}
5472
>
55-
<BtnWrapper>
56-
<PrefixIcon src={`${ICON_CMD}/plus.svg`} />
57-
<div>关注</div>
58-
</BtnWrapper>
59-
</Button>
73+
<div>
74+
<Button
75+
size="small"
76+
type="primary"
77+
onClick={subscribe.bind(this, community.id)}
78+
>
79+
<BtnWrapper>
80+
<PrefixIcon src={`${ICON_CMD}/plus.svg`} />
81+
<div>关注</div>
82+
</BtnWrapper>
83+
</Button>
84+
</div>
85+
</Tooltip>
6086
)}
61-
</div>
87+
</React.Fragment>
6288
)
6389
}
6490

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import styled from 'styled-components'
2+
3+
// import Img from 'components/Img'
4+
import { cs, theme } from 'utils'
5+
6+
export const Wrapper = styled.div`
7+
${cs.flexColumn('align-start')};
8+
`
9+
export const Title = styled.div`
10+
color: ${theme('tooltip.text')};
11+
font-weight: bold;
12+
font-size: 1rem;
13+
`
14+
export const Desc = styled.div`
15+
color: ${theme('tooltip.text')};
16+
margin-top: 10px;
17+
margin-left: 7px;
18+
font-size: 0.9rem;
19+
opacity: 0.8;
20+
`

0 commit comments

Comments
 (0)