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

135 lines
2.6 KiB
Vue
Raw Normal View History

2019-03-30 02:49:32 +11:00
<template>
<div class="emoji-dropdown-menu panel panel-default">
<div class="panel-heading emoji-tabs">
<span class="emoji-tabs-item" :class="{'active': activeGroup === key}" v-for="(value, key) in emojis" :key="key" :title="value.text" @click.prevent="highlight(key)">
<i :class="value.icon"></i>
2019-03-30 07:34:59 +11:00
</span>
</div>
<div class="panel-body emoji-dropdown-menu-content">
<div class="emoji-search">
<input type="text" class="form-control" v-model="keyword" />
</div>
<div class="emoji-groups" ref="emoji-groups" @scroll="scrolledGroup">
<div v-for="(value, key) in emojis" :key="key" class="emoji-group">
<h6 class="emoji-group-title" :ref="'group-' + key">{{value.text}}</h6>
<span
v-for="emoji in value.emojis"
:key="key + emoji.displayText"
:title="emoji.displayText"
class="emoji-item"
@click="onEmoji(emoji)"
>
<span v-if="!emoji.imageUrl">{{emoji.replacement}}</span>
<img :src="emoji.imageUrl" v-else>
2019-03-30 03:48:52 +11:00
</span>
</div>
2019-03-30 02:49:32 +11:00
</div>
</div>
</div>
2019-03-30 02:49:32 +11:00
</template>
2019-07-28 20:56:08 +10:00
<script src="./emoji-picker.js"></script>
2019-03-30 02:49:32 +11:00
<style lang="scss">
@import '../../_variables.scss';
.emoji {
&-dropdown {
position: absolute;
2019-03-30 07:34:59 +11:00
right: 0;
top: 28px;
z-index: 1;
2019-03-30 02:49:32 +11:00
&-toggle {
cursor: pointer;
position: absolute;
top: -23px;
2019-03-30 07:34:59 +11:00
right: 2px;
line-height: 1;
2019-03-30 07:34:59 +11:00
i {
font-size: 18px;
}
2019-03-30 02:49:32 +11:00
}
&-menu {
position: absolute;
z-index: 1;
right: 0;
width: 300px;
height: 300px;
display: flex;
2019-03-30 03:48:52 +11:00
flex-direction: column;
margin: 0 !important;
2019-03-30 03:48:52 +11:00
&-content {
flex: 1 1 1px;
display: flex;
flex-direction: column;
}
}
}
&-tabs {
&-item {
padding: 0 5px;
&.active {
2019-03-30 03:48:52 +11:00
border-bottom: 4px solid;
i {
color: $fallback--lightText;
color: var(--lightText, $fallback--lightText);
}
2019-03-30 02:49:32 +11:00
}
}
}
2019-03-30 03:48:52 +11:00
&-search {
padding: 5px;
input {
width: 100%;
}
2019-03-30 03:48:52 +11:00
}
&-groups {
flex: 1 1 1px;
overflow: auto;
position: relative;
2019-03-30 03:48:52 +11:00
}
&-group {
display: flex;
align-items: center;
flex-wrap: wrap;
width: 100%;
&-title {
font-size: 12px;
width: 100%;
margin: 0;
padding: 5px;
}
}
2019-03-30 02:49:32 +11:00
&-item {
width: 32px;
height: 32px;
2019-03-30 02:49:32 +11:00
box-sizing: border-box;
display: flex;
font-size: 32px;
2019-03-30 02:49:32 +11:00
align-items: center;
justify-content: center;
margin: 2px;
2019-03-30 02:49:32 +11:00
cursor: pointer;
2019-03-30 03:48:52 +11:00
img {
max-width: 100%;
max-height: 100%;
}
2019-03-30 02:49:32 +11:00
}
}
</style>