Skip to content

Commit

Permalink
tooltip: do not use a div container for tooltips
Browse files Browse the repository at this point in the history
Fixes #870
  • Loading branch information
fabiosantoscode committed Jan 10, 2020
1 parent 06f1071 commit a334bc8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Tooltip/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OnlyDesktop, OnlyMobile } from '../styles'
import { OnlyDesktopInline, OnlyMobileInline } from '../styles'
import React, { Component } from 'react'

import DesktopView from './desktop-view'
Expand Down Expand Up @@ -37,21 +37,21 @@ class Tooltip extends Component {
if (this.state.match) {
return (
<>
<OnlyDesktop>
<OnlyDesktopInline>
<DesktopView
description={this.state.description}
header={this.state.header}
id={this.props.id}
text={this.props.text}
/>
</OnlyDesktop>
<OnlyMobile>
</OnlyDesktopInline>
<OnlyMobileInline>
<MobileView
description={this.state.description}
header={this.state.header}
text={this.props.text}
/>
</OnlyMobile>
</OnlyMobileInline>
</>
)
} else {
Expand Down
18 changes: 18 additions & 0 deletions src/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,21 @@ export const OnlyDesktop = styled.div`
${media.phablet`display: none;`};
${media.phone`display: none;`};
`

export const OnlyMobileInline = styled.span`
display: none;
${media.giant`display: none;`};
${media.desktop`display: none;`};
${media.tablet`display: none;`};
${media.phablet`display: inline-block;`};
${media.phone`display: inline-block;`};
`

export const OnlyDesktopInline = styled.span`
display: inline-block;
${media.giant`display: inline-block;`};
${media.desktop`display: inline-block;`};
${media.tablet`display: inline-block;`};
${media.phablet`display: none;`};
${media.phone`display: none;`};
`

0 comments on commit a334bc8

Please sign in to comment.