mirror of
https://github.com/flarum/framework.git
synced 2024-11-28 11:34:36 +08:00
Improve composer appearance/usability on mobile
On mobile: - Move submit button to right side of toolbar - Move first header item to toolbar - Size textarea correctly
This commit is contained in:
parent
1f4e03d1fa
commit
6374f92676
|
@ -71,8 +71,7 @@ export default class CommentPost extends Post {
|
||||||
|
|
||||||
isEditing() {
|
isEditing() {
|
||||||
return app.composer.component instanceof EditPostComposer &&
|
return app.composer.component instanceof EditPostComposer &&
|
||||||
app.composer.component.props.post === this.props.post &&
|
app.composer.component.props.post === this.props.post;
|
||||||
app.composer.position !== Composer.PositionEnum.MINIMIZED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
attrs() {
|
attrs() {
|
||||||
|
|
|
@ -66,6 +66,7 @@ class Composer extends Component {
|
||||||
|
|
||||||
view() {
|
view() {
|
||||||
const classes = {
|
const classes = {
|
||||||
|
'normal': this.position === Composer.PositionEnum.NORMAL,
|
||||||
'minimized': this.position === Composer.PositionEnum.MINIMIZED,
|
'minimized': this.position === Composer.PositionEnum.MINIMIZED,
|
||||||
'fullScreen': this.position === Composer.PositionEnum.FULLSCREEN,
|
'fullScreen': this.position === Composer.PositionEnum.FULLSCREEN,
|
||||||
'active': this.active
|
'active': this.active
|
||||||
|
@ -225,7 +226,7 @@ class Composer extends Component {
|
||||||
const paddingBottom = parseInt($flexible.css('padding-bottom'), 10);
|
const paddingBottom = parseInt($flexible.css('padding-bottom'), 10);
|
||||||
const footerHeight = this.$('.TextEditor-controls').outerHeight(true);
|
const footerHeight = this.$('.TextEditor-controls').outerHeight(true);
|
||||||
|
|
||||||
$flexible.height(height - headerHeight - paddingBottom - footerHeight);
|
$flexible.height(this.$().outerHeight() - headerHeight - paddingBottom - footerHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ export default class ComposerBody extends Component {
|
||||||
this.editor.props.disabled = this.loading;
|
this.editor.props.disabled = this.loading;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ComposerBody">
|
<div className={'ComposerBody ' + (this.props.className || '')}>
|
||||||
{avatar(this.props.user, {className: 'ComposerBody-avatar'})}
|
{avatar(this.props.user, {className: 'ComposerBody-avatar'})}
|
||||||
<div className="ComposerBody-content">
|
<div className="ComposerBody-content">
|
||||||
<ul className="ComposerBody-header">{listItems(this.headerItems().toArray())}</ul>
|
<ul className="ComposerBody-header">{listItems(this.headerItems().toArray())}</ul>
|
||||||
|
|
|
@ -31,12 +31,15 @@ export default class DiscussionComposer extends ComposerBody {
|
||||||
props.submitLabel = props.submitLabel || app.translator.trans('core.forum.composer_discussion.submit_button');
|
props.submitLabel = props.submitLabel || app.translator.trans('core.forum.composer_discussion.submit_button');
|
||||||
props.confirmExit = props.confirmExit || extractText(app.translator.trans('core.forum.composer_discussion.discard_confirmation'));
|
props.confirmExit = props.confirmExit || extractText(app.translator.trans('core.forum.composer_discussion.discard_confirmation'));
|
||||||
props.titlePlaceholder = props.titlePlaceholder || extractText(app.translator.trans('core.forum.composer_discussion.title_placeholder'));
|
props.titlePlaceholder = props.titlePlaceholder || extractText(app.translator.trans('core.forum.composer_discussion.title_placeholder'));
|
||||||
|
props.className = 'ComposerBody--discussion';
|
||||||
}
|
}
|
||||||
|
|
||||||
headerItems() {
|
headerItems() {
|
||||||
const items = super.headerItems();
|
const items = super.headerItems();
|
||||||
|
|
||||||
items.add('title', (
|
items.add('title', <h3>{app.translator.trans('core.forum.composer_discussion.title')}</h3>, 100);
|
||||||
|
|
||||||
|
items.add('discussionTitle', (
|
||||||
<h3>
|
<h3>
|
||||||
<input className="FormControl"
|
<input className="FormControl"
|
||||||
value={this.title()}
|
value={this.title()}
|
||||||
|
|
|
@ -72,6 +72,7 @@ export default class TextEditor extends Component {
|
||||||
children: this.props.submitLabel,
|
children: this.props.submitLabel,
|
||||||
icon: 'check',
|
icon: 'check',
|
||||||
className: 'Button Button--primary',
|
className: 'Button Button--primary',
|
||||||
|
itemClassName: 'App-primaryControl',
|
||||||
onclick: this.onsubmit.bind(this)
|
onclick: this.onsubmit.bind(this)
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -142,6 +142,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.Composer-controls .fa-minus:before {
|
||||||
|
content: @fa-var-times;
|
||||||
|
}
|
||||||
.composer-backdrop {
|
.composer-backdrop {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -172,6 +175,17 @@
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.normal &:first-child {
|
||||||
|
margin: -@header-height-phone 50px 0;
|
||||||
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
|
z-index: @zindex-header + 1;
|
||||||
|
border: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
h3 {
|
h3 {
|
||||||
&, a, input {
|
&, a, input {
|
||||||
|
@ -184,10 +198,9 @@
|
||||||
}
|
}
|
||||||
.ComposerBody-editor {
|
.ComposerBody-editor {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
}
|
||||||
textarea {
|
.ComposerBody-editor .TextEditor-controls .item-submit {
|
||||||
height: 50vh !important;
|
position: absolute !important;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,6 +297,9 @@
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.ComposerBody--discussion .ComposerBody-header .item-title {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media @desktop-up {
|
@media @desktop-up {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user