Skip to content

Commit

Permalink
Do not apply verticalSpacing when withPortal or withFullScreenPortal …
Browse files Browse the repository at this point in the history
…is applied
  • Loading branch information
Maja Wichrowska authored and majapw committed Mar 9, 2018
1 parent 064b96c commit e07e494
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/components/DateRangePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ class DateRangePicker extends React.Component {

const inputHeight = getInputHeight(reactDates, small);

const withAnyPortal = withPortal || withFullScreenPortal;

return (
<div // eslint-disable-line jsx-a11y/no-static-element-interactions
ref={this.setDayPickerContainerRef}
Expand All @@ -371,13 +373,13 @@ class DateRangePicker extends React.Component {
anchorDirection === ANCHOR_RIGHT && styles.DateRangePicker_picker__directionRight,
orientation === HORIZONTAL_ORIENTATION && styles.DateRangePicker_picker__horizontal,
orientation === VERTICAL_ORIENTATION && styles.DateRangePicker_picker__vertical,
openDirection === OPEN_DOWN && {
!withAnyPortal && openDirection === OPEN_DOWN && {
top: inputHeight + verticalSpacing,
},
openDirection === OPEN_UP && {
!withAnyPortal && openDirection === OPEN_UP && {
bottom: inputHeight + verticalSpacing,
},
(withPortal || withFullScreenPortal) && styles.DateRangePicker_picker__portal,
withAnyPortal && styles.DateRangePicker_picker__portal,
withFullScreenPortal && styles.DateRangePicker_picker__fullScreenPortal,
isRTL && styles.DateRangePicker_picker__rtl,
dayPickerContainerStyles,
Expand All @@ -398,7 +400,7 @@ class DateRangePicker extends React.Component {
endDate={endDate}
monthFormat={monthFormat}
renderMonth={renderMonth}
withPortal={withPortal || withFullScreenPortal}
withPortal={withAnyPortal}
daySize={daySize}
initialVisibleMonth={initialVisibleMonthThunk}
hideKeyboardShortcutsPanel={hideKeyboardShortcutsPanel}
Expand Down
10 changes: 6 additions & 4 deletions src/components/SingleDatePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ class SingleDatePicker extends React.Component {

const inputHeight = getInputHeight(reactDates, small);

const withAnyPortal = withPortal || withFullScreenPortal;

return (
<div // eslint-disable-line jsx-a11y/no-static-element-interactions
ref={this.setDayPickerContainerRef}
Expand All @@ -396,15 +398,15 @@ class SingleDatePicker extends React.Component {
anchorDirection === ANCHOR_RIGHT && styles.SingleDatePicker_picker__directionRight,
openDirection === OPEN_DOWN && styles.SingleDatePicker_picker__openDown,
openDirection === OPEN_UP && styles.SingleDatePicker_picker__openUp,
openDirection === OPEN_DOWN && {
!withAnyPortal && openDirection === OPEN_DOWN && {
top: inputHeight + verticalSpacing,
},
openDirection === OPEN_UP && {
!withAnyPortal && openDirection === OPEN_UP && {
bottom: inputHeight + verticalSpacing,
},
orientation === HORIZONTAL_ORIENTATION && styles.SingleDatePicker_picker__horizontal,
orientation === VERTICAL_ORIENTATION && styles.SingleDatePicker_picker__vertical,
(withPortal || withFullScreenPortal) && styles.SingleDatePicker_picker__portal,
withAnyPortal && styles.SingleDatePicker_picker__portal,
withFullScreenPortal && styles.SingleDatePicker_picker__fullScreenPortal,
isRTL && styles.SingleDatePicker_picker__rtl,
dayPickerContainerStyles,
Expand All @@ -419,7 +421,7 @@ class SingleDatePicker extends React.Component {
enableOutsideDays={enableOutsideDays}
numberOfMonths={numberOfMonths}
monthFormat={monthFormat}
withPortal={withPortal || withFullScreenPortal}
withPortal={withAnyPortal}
focused={focused}
keepOpenOnDateSelect={keepOpenOnDateSelect}
hideKeyboardShortcutsPanel={hideKeyboardShortcutsPanel}
Expand Down

0 comments on commit e07e494

Please sign in to comment.