[Glitch] Improvement variable height in single column layout

Port d93b82af87 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
local
Takeshi Umeda 5 years ago committed by ThibG
parent 02d6187894
commit 1329308bc7
  1. 56
      app/javascript/flavours/glitch/components/autosuggest_textarea.js
  2. 45
      app/javascript/flavours/glitch/features/compose/components/compose_form.js
  3. 3
      app/javascript/flavours/glitch/features/ui/components/compose_panel.js
  4. 2
      app/javascript/flavours/glitch/features/ui/index.js
  5. 17
      app/javascript/flavours/glitch/styles/components/composer.scss
  6. 27
      app/javascript/flavours/glitch/styles/components/index.scss
  7. 2
      app/javascript/flavours/glitch/styles/mastodon-light/diff.scss

@ -192,7 +192,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' };
@ -200,34 +200,38 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
style.direction = 'rtl'; style.direction = 'rtl';
} }
return ( return [
<div className='autosuggest-textarea'> <div className='compose-form__autosuggest-wrapper'>
<label> <div className='autosuggest-textarea'>
<span style={{ display: 'none' }}>{placeholder}</span> <label>
<span style={{ display: 'none' }}>{placeholder}</span>
<Textarea
inputRef={this.setTextarea} <Textarea
className='autosuggest-textarea__textarea' inputRef={this.setTextarea}
disabled={disabled} className='autosuggest-textarea__textarea'
placeholder={placeholder} disabled={disabled}
autoFocus={autoFocus} placeholder={placeholder}
value={value} autoFocus={autoFocus}
onChange={this.onChange} value={value}
onKeyDown={this.onKeyDown} onChange={this.onChange}
onKeyUp={onKeyUp} onKeyDown={this.onKeyDown}
onFocus={this.onFocus} onKeyUp={onKeyUp}
onBlur={this.onBlur} onFocus={this.onFocus}
onPaste={this.onPaste} onBlur={this.onBlur}
style={style} onPaste={this.onPaste}
aria-autocomplete='list' style={style}
/> 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>,
); ];
} }
} }

@ -335,32 +335,31 @@ class ComposeForm extends ImmutablePureComponent {
/> />
</div> </div>
<div className='composer--textarea'> <div className='emoji-picker-wrapper'>
<TextareaIcons advancedOptions={advancedOptions} />
<AutosuggestTextarea
ref={this.setAutosuggestTextarea}
placeholder={intl.formatMessage(messages.placeholder)}
disabled={isSubmitting}
value={this.props.text}
onChange={this.handleChange}
suggestions={this.props.suggestions}
onFocus={this.handleFocus}
onKeyDown={this.handleKeyDown}
onSuggestionsFetchRequested={onFetchSuggestions}
onSuggestionsClearRequested={onClearSuggestions}
onSuggestionSelected={this.onSuggestionSelected}
onPaste={onPaste}
autoFocus={!showSearch && !isMobile(window.innerWidth, layout)}
/>
<EmojiPicker onPickEmoji={handleEmoji} /> <EmojiPicker onPickEmoji={handleEmoji} />
</div> </div>
<div className='compose-form__modifiers'> <AutosuggestTextarea
<UploadFormContainer /> ref={this.setAutosuggestTextarea}
<PollFormContainer /> placeholder={intl.formatMessage(messages.placeholder)}
</div> disabled={isSubmitting}
value={this.props.text}
onChange={this.handleChange}
suggestions={this.props.suggestions}
onFocus={this.handleFocus}
onKeyDown={this.handleKeyDown}
onSuggestionsFetchRequested={onFetchSuggestions}
onSuggestionsClearRequested={onClearSuggestions}
onSuggestionSelected={this.onSuggestionSelected}
onPaste={onPaste}
autoFocus={!showSearch && !isMobile(window.innerWidth, layout)}
>
<TextareaIcons advancedOptions={advancedOptions} />
<div className='compose-form__modifiers'>
<UploadFormContainer />
<PollFormContainer />
</div>
</AutosuggestTextarea>
<OptionsContainer <OptionsContainer
advancedOptions={advancedOptions} advancedOptions={advancedOptions}

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

@ -320,7 +320,7 @@ export default class UI extends React.Component {
handleHotkeyNew = e => { handleHotkeyNew = e => {
e.preventDefault(); e.preventDefault();
const element = this.node.querySelector('.composer--textarea textarea'); const element = this.node.querySelector('.compose-form__autosuggest-wrapper textarea');
if (element) { if (element) {
element.focus(); element.focus();

@ -12,7 +12,8 @@
opacity: 0.0; opacity: 0.0;
&.composer--spoiler--visible { &.composer--spoiler--visible {
height: 47px; height: 36px;
margin-bottom: 11px;
opacity: 1.0; opacity: 1.0;
} }
@ -98,6 +99,9 @@
border-radius: 4px; border-radius: 4px;
padding: 10px; padding: 10px;
background: $ui-primary-color; background: $ui-primary-color;
min-height: 23px;
overflow-y: auto;
flex: 0 2 auto;
& > header { & > header {
margin-bottom: 5px; margin-bottom: 5px;
@ -218,6 +222,7 @@
position: absolute; position: absolute;
right: 5px; right: 5px;
top: 5px; top: 5px;
z-index: 1;
::-webkit-scrollbar-track:hover, ::-webkit-scrollbar-track:hover,
::-webkit-scrollbar-track:active { ::-webkit-scrollbar-track:active {
@ -225,7 +230,7 @@
} }
} }
.composer--textarea, .compose-form__autosuggest-wrapper,
.autosuggest-input { .autosuggest-input {
position: relative; position: relative;
@ -284,6 +289,12 @@
} }
} }
.emoji-picker-wrapper,
.autosuggest-textarea__suggestions-wrapper {
position: relative;
height: 0;
}
.autosuggest-textarea__suggestions { .autosuggest-textarea__suggestions {
display: block; display: block;
position: absolute; position: absolute;
@ -485,6 +496,7 @@
box-shadow: inset 0 5px 5px rgba($base-shadow-color, 0.05); box-shadow: inset 0 5px 5px rgba($base-shadow-color, 0.05);
border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;
height: 27px; height: 27px;
flex: 0 0 auto;
& > * { & > * {
display: inline-block; display: inline-block;
@ -575,6 +587,7 @@
text-align: right; text-align: right;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
justify-content: flex-end;
& > .count { & > .count {
display: inline-block; display: inline-block;

@ -818,7 +818,8 @@
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;
@ -834,14 +835,33 @@
.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 {
@ -851,6 +871,9 @@
.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;

@ -125,7 +125,7 @@
// Change the default color of several parts of the compose form // Change the default color of several parts of the compose form
.composer { .composer {
.composer--spoiler input, .composer--textarea textarea { .composer--spoiler input, .compose-form__autosuggest-wrapper textarea {
color: lighten($ui-base-color, 80%); color: lighten($ui-base-color, 80%);
&:disabled { background: lighten($simple-background-color, 10%) } &:disabled { background: lighten($simple-background-color, 10%) }

Loading…
Cancel
Save