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

Commit a4ba049

Browse files
committed
chore: Merge branch 'tooltip' into dev
2 parents b34bfe6 + 301e7fe commit a4ba049

File tree

4 files changed

+24
-28
lines changed

4 files changed

+24
-28
lines changed

components/Tooltip/styles/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ export const Wrapper = styled(Tippy)`
1616
}
1717
&[x-placement^='bottom'] {
1818
.tippy-arrow {
19-
border-top-color: ${theme('tooltip.bg')};
19+
border-bottom-color: ${theme('tooltip.bg')};
2020
}
2121
}
2222
&[x-placement^='left'] {
2323
.tippy-arrow {
24-
border-top-color: ${theme('tooltip.bg')};
24+
border-left-color: ${theme('tooltip.bg')};
2525
}
2626
}
2727
&[x-placement^='right'] {
2828
.tippy-arrow {
29-
border-top-color: ${theme('tooltip.bg')};
29+
border-right-color: ${theme('tooltip.bg')};
3030
}
3131
}
3232
`

components/UserBrief/SocialIcons.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import React from 'react'
22
import R from 'ramda'
3-
import ReactTooltip from 'react-tooltip'
43

54
import { ICON_CMD } from '@config'
6-
75
import { nilOrEmpty, SOCIAL_LISTS } from '@utils'
8-
import { Wrapper, Linker, SocialIcon } from './styles/social_icons'
96

10-
const tooltipOffset = JSON.stringify({ left: 3 })
7+
import Tooltip from '@components/Tooltip'
8+
import { Wrapper, Linker, SocialIcon } from './styles/social_icons'
119

1210
const DisplayIcon = ({ user, social }) => {
1311
if (user[social.key] && !R.contains(social.key, ['qq', 'weichat'])) {
@@ -25,17 +23,18 @@ const DisplayIcon = ({ user, social }) => {
2523
)
2624
}
2725
return (
28-
<div
26+
<Tooltip
2927
key={social.key}
30-
data-tip={user.social[social.key]}
31-
data-for="social_icons"
32-
data-offset={tooltipOffset}
28+
content={user.social[social.key]}
29+
placement="bottom"
3330
>
34-
<SocialIcon
35-
src={`${ICON_CMD}/${social.key}.svg`}
36-
active={!nilOrEmpty(user.social[social.key])}
37-
/>
38-
</div>
31+
<div>
32+
<SocialIcon
33+
src={`${ICON_CMD}/${social.key}.svg`}
34+
active={!nilOrEmpty(user.social[social.key])}
35+
/>
36+
</div>
37+
</Tooltip>
3938
)
4039
}
4140

@@ -44,7 +43,6 @@ const SocialIcons = ({ user }) => (
4443
{SOCIAL_LISTS.map(social => (
4544
<DisplayIcon key={social.key} user={user} social={social} />
4645
))}
47-
<ReactTooltip effect="solid" place="bottom" id="social_icons" />
4846
</Wrapper>
4947
)
5048

containers/AccountViewer/Planets.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from 'react'
2-
import ReactTooltip from 'react-tooltip'
32
import R from 'ramda'
43

54
import { sortByIndex } from '@utils'
5+
import Tooltip from '@components/Tooltip'
6+
67
import {
78
Wrapper,
89
HeaderWrapper,
@@ -12,7 +13,6 @@ import {
1213
PlanetsIcon,
1314
} from './styles/planets'
1415

15-
const tooltipOffset = JSON.stringify({ top: 10, left: 5 })
1616
const Planets = ({ subscribedCommunities, viewingType }) => {
1717
if (!subscribedCommunities) return null
1818

@@ -38,17 +38,17 @@ const Planets = ({ subscribedCommunities, viewingType }) => {
3838
</HeaderWrapper>
3939
<IconList>
4040
{sortedCommunities.map(community => (
41-
<div
41+
<Tooltip
4242
key={community.raw}
43-
data-tip={community.title}
44-
data-for="planet_icon"
45-
data-offset={tooltipOffset}
43+
content={community.title}
44+
placement="top"
4645
>
47-
<PlanetsIcon src={community.logo} />
48-
</div>
46+
<div>
47+
<PlanetsIcon src={community.logo} />
48+
</div>
49+
</Tooltip>
4950
))}
5051
</IconList>
51-
<ReactTooltip effect="solid" place="bottom" id="planet_icon" />
5252
</Wrapper>
5353
)
5454
}

containers/AccountViewer/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import React from 'react'
88
import R from 'ramda'
9-
import ReactTooltip from 'react-tooltip'
109

1110
import { connectStore, buildLog } from '@utils'
1211

@@ -41,7 +40,6 @@ const AccountViewerContainer = ({ accountViewer, user }) => {
4140
<AccountWrapper>
4241
{!R.isEmpty(userInfoData.id) && (
4342
<React.Fragment>
44-
<ReactTooltip effect="solid" place="bottom" />
4543
<AccountContent>
4644
<UserBrief
4745
user={userInfoData}

0 commit comments

Comments
 (0)