pleroma-fe/src/components/emoji-input/emoji-input.vue

49 lines
1 KiB
Vue
Raw Normal View History

2019-03-26 13:38:15 +11:00
<template>
<div class="emoji-input">
<slot></slot>
<div ref="panel" class="autocomplete-panel" :class="{ hide: suggestions}">
<div class="autocomplete-panel-body">
<div
v-for="(suggestion, index) in suggestions"
:key="index"
@click.stop.prevent="replace(suggestion.replacement)"
class="autocomplete-item"
:class="{ highlighted: suggestion.highlighted }"
2019-03-26 13:38:15 +11:00
>
<span v-if="suggestion.img">
<img :src="suggestion.img" />
</span>
<span v-else>{{suggestion.replacement}}</span>
<span>{{suggestion.displayText}}</span>
<span>{{suggestion.detailText}}</span>
2019-03-26 13:38:15 +11:00
</div>
</div>
</div>
</div>
2019-03-26 13:38:15 +11:00
</template>
<script src="./emoji-input.js"></script>
<style lang="scss">
@import '../../_variables.scss';
.emoji-input {
display: flex;
flex-direction: column;
&.hide {
display: none
}
.autocomplete-panel {
position: absolute;
z-index: 9;
margin-top: 2px;
}
input, textarea {
flex: 1;
2019-03-26 13:38:15 +11:00
}
}
</style>