11import React from 'react'
2- import { Button , Tooltip } from 'antd'
2+ import { Button } from 'antd'
33
44import { ICON_CMD } from '@config'
55
6+ import Tooltip from '@components/Tooltip'
7+ import Hinter from './Hinter'
8+
69import { SubscribedBox , BtnWrapper , PrefixIcon } from './styles'
710import { subscribe , unSubscribe } from './logic'
811
912const 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
3450const 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
0 commit comments