Improvement variable height in single column layout (#10917)

* Improvement variable height of compose and navigation panel in single column layout

* Fix wrong quotes and missing commas
This commit is contained in:
Takeshi Umeda 2019-06-02 17:05:54 +09:00 committed by Eugen Rochko
parent 2e13f2ac44
commit d93b82af87
4 changed files with 94 additions and 57 deletions

View file

@ -189,7 +189,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
} }
render () { render () {
const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus } = this.props; const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children } = this.props;
const { suggestionsHidden } = this.state; const { suggestionsHidden } = this.state;
const style = { direction: 'ltr' }; const style = { direction: 'ltr' };
@ -197,7 +197,8 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
style.direction = 'rtl'; style.direction = 'rtl';
} }
return ( return [
<div className='compose-form__autosuggest-wrapper'>
<div className='autosuggest-textarea'> <div className='autosuggest-textarea'>
<label> <label>
<span style={{ display: 'none' }}>{placeholder}</span> <span style={{ display: 'none' }}>{placeholder}</span>
@ -219,12 +220,15 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
aria-autocomplete='list' aria-autocomplete='list'
/> />
</label> </label>
</div>
{children}
</div>,
<div className='autosuggest-textarea__suggestions-wrapper'>
<div className={`autosuggest-textarea__suggestions ${suggestionsHidden || suggestions.isEmpty() ? '' : 'autosuggest-textarea__suggestions--visible'}`}> <div className={`autosuggest-textarea__suggestions ${suggestionsHidden || suggestions.isEmpty() ? '' : 'autosuggest-textarea__suggestions--visible'}`}>
{suggestions.map(this.renderSuggestion)} {suggestions.map(this.renderSuggestion)}
</div> </div>
</div> </div>,
); ];
} }
} }

View file

@ -200,7 +200,10 @@ class ComposeForm extends ImmutablePureComponent {
/> />
</div> </div>
<div className='compose-form__autosuggest-wrapper'> <div className='emoji-picker-wrapper'>
<EmojiPickerDropdown onPickEmoji={this.handleEmojiPick} />
</div>
<AutosuggestTextarea <AutosuggestTextarea
ref={this.setAutosuggestTextarea} ref={this.setAutosuggestTextarea}
placeholder={intl.formatMessage(messages.placeholder)} placeholder={intl.formatMessage(messages.placeholder)}
@ -214,15 +217,12 @@ class ComposeForm extends ImmutablePureComponent {
onSuggestionSelected={this.onSuggestionSelected} onSuggestionSelected={this.onSuggestionSelected}
onPaste={onPaste} onPaste={onPaste}
autoFocus={!showSearch && !isMobile(window.innerWidth)} autoFocus={!showSearch && !isMobile(window.innerWidth)}
/> >
<EmojiPickerDropdown onPickEmoji={this.handleEmojiPick} />
</div>
<div className='compose-form__modifiers'> <div className='compose-form__modifiers'>
<UploadFormContainer /> <UploadFormContainer />
<PollFormContainer /> <PollFormContainer />
</div> </div>
</AutosuggestTextarea>
<div className='compose-form__buttons-wrapper'> <div className='compose-form__buttons-wrapper'>
<div className='compose-form__buttons'> <div className='compose-form__buttons'>

View file

@ -9,9 +9,6 @@ const ComposePanel = () => (
<SearchContainer openInRoute /> <SearchContainer openInRoute />
<NavigationContainer /> <NavigationContainer />
<ComposeFormContainer /> <ComposeFormContainer />
<div className='flex-spacer' />
<LinkFooter withHotkeys /> <LinkFooter withHotkeys />
</div> </div>
); );

View file

@ -333,14 +333,15 @@
} }
} }
.compose-form__autosuggest-wrapper {
position: relative;
.emoji-picker-dropdown { .emoji-picker-dropdown {
position: absolute; position: absolute;
right: 5px;
top: 5px; top: 5px;
right: 5px;
z-index: 1;
} }
.compose-form__autosuggest-wrapper {
position: relative;
} }
.autosuggest-textarea, .autosuggest-textarea,
@ -355,7 +356,8 @@
opacity: 0.0; opacity: 0.0;
&.spoiler-input--visible { &.spoiler-input--visible {
height: 47px; height: 36px;
margin-bottom: 11px;
opacity: 1.0; opacity: 1.0;
} }
} }
@ -406,6 +408,12 @@
} }
} }
.emoji-picker-wrapper,
.autosuggest-textarea__suggestions-wrapper {
position: relative;
height: 0;
}
.autosuggest-textarea__suggestions { .autosuggest-textarea__suggestions {
box-sizing: border-box; box-sizing: border-box;
display: none; display: none;
@ -566,6 +574,7 @@
border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex: 0 0 auto;
.compose-form__buttons { .compose-form__buttons {
display: flex; display: flex;
@ -614,6 +623,7 @@
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
min-width: 0; min-width: 0;
flex: 0 0 auto;
.compose-form__publish-button-wrapper { .compose-form__publish-button-wrapper {
overflow: hidden; overflow: hidden;
@ -644,6 +654,9 @@
margin-bottom: 10px; margin-bottom: 10px;
background: $ui-primary-color; background: $ui-primary-color;
padding: 10px; padding: 10px;
min-height: 23px;
overflow-y: auto;
flex: 0 2 auto;
} }
.reply-indicator__header { .reply-indicator__header {
@ -2184,7 +2197,8 @@ a.account__display-name {
margin-top: 10px; margin-top: 10px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: calc(100% - 10px);
overflow-y: hidden;
.search__input { .search__input {
line-height: 18px; line-height: 18px;
@ -2200,14 +2214,33 @@ a.account__display-name {
.navigation-bar { .navigation-bar {
padding-top: 20px; padding-top: 20px;
padding-bottom: 20px; padding-bottom: 20px;
flex: 0 1 48px;
min-height: 20px;
} }
.flex-spacer { .flex-spacer {
background: transparent; background: transparent;
} }
.compose-form {
flex: 1;
overflow-y: hidden;
display: flex;
flex-direction: column;
min-height: 310px;
padding-bottom: 71px;
margin-bottom: -71px;
}
.compose-form__autosuggest-wrapper {
overflow-y: auto;
background-color: $white;
border-radius: 4px 4px 0 0;
flex: 0 1 auto;
}
.autosuggest-textarea__textarea { .autosuggest-textarea__textarea {
max-height: 200px; overflow-y: hidden;
} }
.compose-form__upload-thumbnail { .compose-form__upload-thumbnail {
@ -2217,6 +2250,9 @@ a.account__display-name {
.navigation-panel { .navigation-panel {
margin-top: 10px; margin-top: 10px;
margin-bottom: 10px;
height: calc(100% - 20px);
overflow-y: auto;
hr { hr {
border: 0; border: 0;