forked from AkkomaGang/akkoma-fe
#101 - add emoji selector basic mockup
This commit is contained in:
parent
25370083b6
commit
2c4e80aab3
4 changed files with 97 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
|||
import Completion from '../../services/completion/completion.js'
|
||||
import EmojiSelector from '../emoji-selector/emoji-selector.vue'
|
||||
|
||||
import { take, filter, map } from 'lodash'
|
||||
|
||||
const EmojiInput = {
|
||||
|
@ -14,6 +16,9 @@ const EmojiInput = {
|
|||
caret: 0
|
||||
}
|
||||
},
|
||||
components: {
|
||||
EmojiSelector
|
||||
},
|
||||
computed: {
|
||||
suggestions () {
|
||||
const firstchar = this.textAtCaret.charAt(0)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<template>
|
||||
<div class="emoji-input">
|
||||
<EmojiSelector />
|
||||
<input
|
||||
v-if="type !== 'textarea'"
|
||||
:class="classname"
|
||||
|
|
26
src/components/emoji-selector/emoji-selector.js
Normal file
26
src/components/emoji-selector/emoji-selector.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
const EmojiSelector = {
|
||||
data () {
|
||||
return {
|
||||
open: false
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
console.log(this.$store.state.instance.emoji)
|
||||
console.log(this.$store.state.instance.customEmoji)
|
||||
},
|
||||
methods: {
|
||||
togglePanel () {
|
||||
this.open = !this.open
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
standardEmoji () {
|
||||
return this.$store.state.instance.emoji || []
|
||||
},
|
||||
customEmoji () {
|
||||
return this.$store.state.instance.customEmoji || []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default EmojiSelector
|
65
src/components/emoji-selector/emoji-selector.vue
Normal file
65
src/components/emoji-selector/emoji-selector.vue
Normal file
|
@ -0,0 +1,65 @@
|
|||
<template>
|
||||
<div class="emoji-dropdown">
|
||||
<span class="emoji-dropdown-toggle" @click="togglePanel">Emoji</span>
|
||||
<div class="emoji-dropdown-menu" v-if="open">
|
||||
<span v-for="emoji in standardEmoji" :key="'standard' + emoji.shortcode" :title="emoji.shortcode" class="emoji-item">
|
||||
<span v-if="!emoji.image_url">{{emoji.utf}}</span>
|
||||
<img :src="emoji.utf" v-else>
|
||||
</span>
|
||||
<span v-for="emoji in customEmoji" :key="'custom' + emoji.shortcode" :title="emoji.shortcode" class="emoji-item">
|
||||
<span v-if="!emoji.image_url">{{emoji.utf}}</span>
|
||||
<img :src="'https://bikeshed.party' + emoji.image_url" v-else>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="./emoji-selector.js"></script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '../../_variables.scss';
|
||||
|
||||
.emoji {
|
||||
&-dropdown {
|
||||
position: relative;
|
||||
|
||||
&-toggle {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&-menu {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
right: 0;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
background: white;
|
||||
border: 1px solid $fallback--faint;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
overflow: auto;
|
||||
margin-bottom: 5px;
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-item {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
font-size: 16px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: black;
|
||||
padding: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
Loading…
Reference in a new issue