1
0
mirror of https://github.com/flarum/core.git synced 2025-07-21 16:51:34 +02:00

Responsive fixes

- Make composer absolutely positioned on mobile to work around iOS 8/9
bug
- Make search results dropdown appear on mobile

closes flarum/core#137
This commit is contained in:
Toby Zerner
2015-08-04 11:27:51 +09:30
parent 856ebe9d42
commit 7154558239
4 changed files with 38 additions and 3 deletions

View File

@@ -260,6 +260,14 @@ class Composer extends Component {
$composer.show()
.css({height: oldHeight})
.animate({bottom: 0, height: newHeight}, 'fast', this.component.focus.bind(this.component));
if ($composer.css('position') === 'absolute') {
$composer.css('top', $(window).scrollTop());
this.$backdrop = $('<div/>')
.addClass('composer-backdrop')
.appendTo('body');
}
} else {
this.component.focus();
}
@@ -268,20 +276,24 @@ class Composer extends Component {
case Composer.PositionEnum.MINIMIZED:
// If the composer has been minimized, we will animate it shrinking down
// to its new smaller size.
$composer.css({height: oldHeight})
$composer.css({top: 'auto', height: oldHeight})
.animate({height: newHeight}, 'fast');
if (this.$backdrop) this.$backdrop.remove();
break;
case Composer.PositionEnum.HIDDEN:
// If the composer has been hidden, then we will animate it sliding down
// beyond the edge of the viewport. Once the animation is complete, we
// un-draw the composer's component.
$composer.css({height: oldHeight})
$composer.css({top: 'auto', height: oldHeight})
.animate({bottom: -newHeight}, 'fast', () => {
$composer.hide();
this.clear();
m.redraw();
});
if (this.$backdrop) this.$backdrop.remove();
break;
case Composer.PositionEnum.FULLSCREEN:

View File

@@ -75,7 +75,7 @@ export default class Search extends Component {
}
return (
<div className={'Search Dropdown ' + classList({
<div className={'Search ' + classList({
open: this.value() && this.hasFocus,
active: !!currentSearch,
loading: !!this.loadingSources