From b4e53576f29d247bd890e890316d2ed026a3d057 Mon Sep 17 00:00:00 2001
From: jared <jaredrmain@gmail.com>
Date: Fri, 5 Apr 2019 14:51:25 -0400
Subject: #101 - bind scroll event, highlight relevent section by tabs

---
 src/components/emoji-selector/emoji-selector.vue | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'src/components/emoji-selector/emoji-selector.vue')

diff --git a/src/components/emoji-selector/emoji-selector.vue b/src/components/emoji-selector/emoji-selector.vue
index f05ff1e9..ddab2659 100644
--- a/src/components/emoji-selector/emoji-selector.vue
+++ b/src/components/emoji-selector/emoji-selector.vue
@@ -5,7 +5,7 @@
     </span>
     <div class="emoji-dropdown-menu panel panel-default" v-if="open">
       <div class="panel-heading emoji-tabs">
-        <span class="emoji-tabs-item" v-for="(value, key) in emojis" :key="key" :title="value.text">
+        <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>
         </span>
       </div>
@@ -13,9 +13,9 @@
         <div class="emoji-search">
           <input type="text" class="form-control" v-model="keyword" />
         </div>
-        <div class="emoji-groups">
+        <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">{{value.text}}</h6>
+            <h6 class="emoji-group-title" :ref="'group-' + key">{{value.text}}</h6>
             <span
               v-for="emoji in value.emojis"
               :key="key + emoji.shortcode"
@@ -78,7 +78,7 @@
     &-item {
       padding: 0 5px;
 
-      &:first-child, &.active {
+      &.active {
         border-bottom: 4px solid;
 
         i {
@@ -96,6 +96,7 @@
   &-groups {
     flex: 1 1 1px;
     overflow: auto;
+    position: relative;
   }
 
   &-group {
-- 
cgit v1.2.3-70-g09d2

