1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-20 21:54:58 -04:00

Use Portal component in AutoSuggestInput

This commit is contained in:
Mark McDowall
2019-04-25 21:47:29 -07:00
parent dadab50f3b
commit c9bdf43a0d
2 changed files with 60 additions and 74 deletions
@@ -115,6 +115,23 @@ class EnhancedSelectInput extends Component {
//
// Listeners
onComputeMaxHeight = (data) => {
const {
top,
bottom
} = data.offsets.reference;
const windowHeight = window.innerHeight;
if ((/^botton/).test(data.placement)) {
data.styles.maxHeight = windowHeight - bottom;
} else {
data.styles.maxHeight = top;
}
return data;
}
onWindowClick = (event) => {
const button = document.getElementById(this._buttonId);
const options = document.getElementById(this._optionsId);
@@ -314,22 +331,7 @@ class EnhancedSelectInput extends Component {
computeMaxHeight: {
order: 851,
enabled: true,
fn: (data) => {
const {
top,
bottom
} = data.offsets.reference;
const windowHeight = window.innerHeight;
if ((/^botton/).test(data.placement)) {
data.styles.maxHeight = windowHeight - bottom - POPPER_PADDING;
} else {
data.styles.maxHeight = top - POPPER_PADDING;
}
return data;
}
fn: this.onComputeMaxHeight
}
}}
>