@@ -9,7 +9,8 @@ import getScrollLeft from 'dom-helpers/query/scrollLeft';
99class Popup extends React . Component {
1010
1111 componentDidMount ( ) {
12- let { top, left, width, height } = getOffset ( this . refs . root )
12+ let { popupOffset = 5 } = this . props
13+ , { top, left, width, height } = getOffset ( this . refs . root )
1314 , viewBottom = window . innerHeight + getScrollTop ( window )
1415 , viewRight = window . innerWidth + getScrollLeft ( window )
1516 , bottom = top + height
@@ -19,11 +20,11 @@ class Popup extends React.Component {
1920 let topOffset , leftOffset ;
2021
2122 if ( bottom > viewBottom )
22- topOffset = bottom - viewBottom + 5
23+ topOffset = bottom - viewBottom + ( popupOffset . y || + popupOffset || 0 )
2324 if ( right > viewRight )
24- leftOffset = right - viewRight + 5
25+ leftOffset = right - viewRight + ( popupOffset . x || + popupOffset || 0 )
2526
26- this . setState ( { topOffset, leftOffset } )
27+ this . setState ( { topOffset, leftOffset } ) //eslint-disable-line
2728 }
2829 }
2930
@@ -37,7 +38,8 @@ class Popup extends React.Component {
3738 let style = {
3839 top : top - topOffset ,
3940 left : left - leftOffset ,
40- minWidth : width + ( width / 2 )
41+ minWidth : width + ( width / 2 ) ,
42+ height : 300
4143 }
4244
4345 return (
0 commit comments