mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Guild textarea at list positioning (#10663)
* autocomplete dialog now has ternary operator to determine placement * added min height to textbox * fixed spacing according to travisCI * heightToUse function now retrieves argument from props
This commit is contained in:
committed by
Matteo Pagliazzi
parent
97021e3422
commit
e7969987ec
@@ -14,7 +14,7 @@ div.autocomplete-selection(v-if='searchResults.length > 0', :style='autocomplete
|
|||||||
import groupBy from 'lodash/groupBy';
|
import groupBy from 'lodash/groupBy';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['selections', 'text', 'coords', 'chat'],
|
props: ['selections', 'text', 'coords', 'chat', 'textbox'],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
currentSearch: '',
|
currentSearch: '',
|
||||||
@@ -25,9 +25,15 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
autocompleteStyle () {
|
autocompleteStyle () {
|
||||||
|
function heightToUse (textBox, topCoords) {
|
||||||
|
let textBoxHeight = textBox['user-entry'].clientHeight;
|
||||||
|
return topCoords < textBoxHeight ? topCoords + 30 : textBoxHeight + 10;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
top: `${this.coords.TOP + 30}px`,
|
top: `${heightToUse(this.textbox, this.coords.TOP)}px`,
|
||||||
left: `${this.coords.LEFT + 30}px`,
|
left: `${this.coords.LEFT + 30}px`,
|
||||||
|
marginLeft: '-28px',
|
||||||
|
marginTop: '28px',
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
minWidth: '100px',
|
minWidth: '100px',
|
||||||
minHeight: '100px',
|
minHeight: '100px',
|
||||||
@@ -42,6 +48,7 @@ export default {
|
|||||||
return option.toLowerCase().indexOf(currentSearch.toLowerCase()) !== -1;
|
return option.toLowerCase().indexOf(currentSearch.toLowerCase()) !== -1;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.grabUserNames();
|
this.grabUserNames();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
.row
|
.row
|
||||||
textarea(:placeholder='placeholder',
|
textarea(:placeholder='placeholder',
|
||||||
v-model='newMessage',
|
v-model='newMessage',
|
||||||
|
ref='user-entry',
|
||||||
:class='{"user-entry": newMessage}',
|
:class='{"user-entry": newMessage}',
|
||||||
@keydown='updateCarretPosition',
|
@keydown='updateCarretPosition',
|
||||||
@keyup.ctrl.enter='sendMessageShortcut()',
|
@keyup.ctrl.enter='sendMessageShortcut()',
|
||||||
@@ -16,6 +17,7 @@
|
|||||||
autocomplete(
|
autocomplete(
|
||||||
:text='newMessage',
|
:text='newMessage',
|
||||||
v-on:select="selectedAutocomplete",
|
v-on:select="selectedAutocomplete",
|
||||||
|
:textbox='textbox',
|
||||||
:coords='coords',
|
:coords='coords',
|
||||||
:chat='group.chat')
|
:chat='group.chat')
|
||||||
|
|
||||||
@@ -62,6 +64,7 @@
|
|||||||
TOP: 0,
|
TOP: 0,
|
||||||
LEFT: 0,
|
LEFT: 0,
|
||||||
},
|
},
|
||||||
|
textbox: this.$refs,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -187,7 +190,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
height: 150px;
|
min-height: 150px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: $white;
|
background-color: $white;
|
||||||
border: solid 1px $gray-400;
|
border: solid 1px $gray-400;
|
||||||
|
|||||||
Reference in New Issue
Block a user