Skip to content

Commit

Permalink
fix(tooltip): Change class hierarchy of responsive classes to properl…
Browse files Browse the repository at this point in the history
…y to directionality
  • Loading branch information
ryanoglesby08 committed Nov 27, 2017
1 parent 0a5db9f commit 01ee4d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 29 deletions.
35 changes: 9 additions & 26 deletions src/components/Tooltip/Tooltip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,39 +96,22 @@ class Tooltip extends React.Component {
)
}

renderResponsiveBubble(id, direction, open, content) {
return (
<div>
<Responsive maxWidth="sm">
{matches => {
const size = 'bubbleXsmall'
return matches && this.renderBubble(id, direction, open, content, size)
}}
</Responsive>
<Responsive minWidth="sm" maxWidth="md">
{matches => {
const size = 'bubbleSmall'
return matches && this.renderBubble(id, direction, open, content, size)
}}
</Responsive>
<Responsive minWidth="md">
{matches => {
const size = 'bubbleDesktop'
return matches && this.renderBubble(id, direction, open, content, size)
}}
</Responsive>
</div>
)
}

render() {
const { direction, connectedFieldLabel, children, ...rest } = this.props

const { bubbleId, triggerId } = getIds(connectedFieldLabel)

return (
<div {...safeRest(rest)} className={iconWrapperStyles.fixLineHeight}>
{this.renderResponsiveBubble(bubbleId, direction, this.state.open, children)}
<Responsive maxWidth="sm">
{this.renderBubble(bubbleId, direction, this.state.open, children, 'bubbleXsmall')}
</Responsive>
<Responsive minWidth="sm" maxWidth="md">
{this.renderBubble(bubbleId, direction, this.state.open, children, 'bubbleSmall')}
</Responsive>
<Responsive minWidth="md">
{this.renderBubble(bubbleId, direction, this.state.open, children, 'bubbleDesktop')}
</Responsive>

<StandaloneIcon
symbol="questionMarkCircle"
Expand Down
6 changes: 3 additions & 3 deletions src/components/Tooltip/Tooltip.modules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,23 @@ $bubble-triangle-position: $bubble-triangle-width + 5px;
.bubbleXsmall {
width: 100%;

.right {
&.right {
@include left-bubble;
}
}

.bubbleSmall {
width: 50%;

.right {
&.right {
@include left-bubble;
}
}

.bubbleDesktop {
width: 25%;

.right {
&.right {
left: calc(100% - #{$bubble-trigger-size} - #{$bubble-offset});

&::before {
Expand Down

0 comments on commit 01ee4d2

Please sign in to comment.