Skip to content

Commit

Permalink
Review fixes and updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bp committed Feb 1, 2018
1 parent 31d946c commit f88dbee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions docs/app/Examples/modules/Popup/Variations/PopupExampleOffset.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ const PopupExampleOffset = () => (
<Popup
trigger={<Icon name='heart' size='large' circular />}
content='I am positioned to the left center but, I am now way off to the left if I fit in viewport'
horizontalOffset={400}
horizontalOffset={100}
position='left center'
/>
</Grid.Column>
<Grid.Column floated='right' textAlign='right'>
<Popup
trigger={<Icon name='heart' size='large' circular />}
content='I am positioned to the right center but, I am now way off to right if I fit in viewport'
horizontalOffset={400}
horizontalOffset={100}
position='right center'
/>
</Grid.Column>
Expand All @@ -55,15 +55,15 @@ const PopupExampleOffset = () => (
trigger={<Icon name='heart' size='large' circular />}
content='I am positioned to the bottom left but, I am now way off to bottom and left if I fit in viewport'
horizontalOffset={100}
verticalOffset={100}
verticalOffset={-100}
position='bottom left'
/>
</Grid.Column>
<Grid.Column textAlign='center'>
<Popup
trigger={<Icon name='heart' size='large' circular />}
content='I am positioned to the bottom center but, I am now way off to the bottom if I fit in viewport'
verticalOffset={100}
verticalOffset={-100}
position='bottom center'
/>
</Grid.Column>
Expand All @@ -72,7 +72,7 @@ const PopupExampleOffset = () => (
trigger={<Icon name='heart' size='large' circular />}
content='I am positioned to the bottom right but, I am now way off to bottom and right if I fit in viewport'
horizontalOffset={100}
verticalOffset={100}
verticalOffset={-100}
position='bottom right'
/>
</Grid.Column>
Expand Down
6 changes: 3 additions & 3 deletions src/modules/Popup/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ export default class Popup extends Component {
}

applyVeriticalOffset = ({ top, bottom }, offset) => {
if (_.isNumber(top)) return { bottom, top: top + offset }
if (_.isNumber(top)) return { bottom, top: top - offset }
return { top, bottom: bottom + offset }
}

applyHorizontalOffset = ({ right, left }, offset) => {
if (_.isNumber(right)) return { left, right: right + offset }
return { right, left: left + offset }
if (_.isNumber(right)) return { left, right: right - offset }
return { right, left: left - offset }
}

// check if the style would display
Expand Down
10 changes: 5 additions & 5 deletions test/specs/modules/Popup/Popup-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('Popup', () => {
it('accepts an offset to the left', () => {
wrapperMount(
<Popup
horizontalOffset={1000}
horizontalOffset={-1000}
position='bottom left'
content='foo'
trigger={<button>foo</button>}
Expand All @@ -101,7 +101,7 @@ describe('Popup', () => {
it('accepts an offset to the left', () => {
wrapperMount(
<Popup
horizontalOffset={1000}
horizontalOffset={-1000}
verticalOffset={0}
position='bottom left'
content='foo'
Expand All @@ -121,7 +121,7 @@ describe('Popup', () => {
wrapperMount(
<Popup
horizontalOffset={0}
verticalOffset={1000}
verticalOffset={-1000}
position='bottom left'
content='foo'
trigger={<button>foo</button>}
Expand All @@ -139,8 +139,8 @@ describe('Popup', () => {
it('accepts an offset to both top and left', () => {
wrapperMount(
<Popup
horizontalOffset={1000}
verticalOffset={1000}
horizontalOffset={-1000}
verticalOffset={-1000}
position='bottom left'
content='foo'
trigger={<button>foo</button>}
Expand Down

0 comments on commit f88dbee

Please sign in to comment.