diff --git a/web/app/components/base/emoji-picker/index.tsx b/web/app/components/base/emoji-picker/index.tsx index 30136c3fa1..63ad3cc87c 100644 --- a/web/app/components/base/emoji-picker/index.tsx +++ b/web/app/components/base/emoji-picker/index.tsx @@ -1,13 +1,13 @@ 'use client' import data from '@emoji-mart/data' -import { init } from 'emoji-mart' +import { init, SearchIndex } from 'emoji-mart' // import AppIcon from '@/app/components/base/app-icon' import cn from 'classnames' import Divider from '@/app/components/base/divider' import Button from '@/app/components/base/button' import s from './style.module.css' -import { useState, FC } from 'react' +import { useState, FC, ChangeEvent } from 'react' import { MagnifyingGlassIcon } from '@heroicons/react/24/outline' @@ -27,6 +27,16 @@ declare global { init({ data }) +async function search(value: string) { + const emojis = await SearchIndex.search(value) || [] + + const results = emojis.map((emoji: any) => { + return emoji.skins[0].native + }) + + console.log(results) +} + const backgroundColors = [ '#FFEAD5', '#E4FBCC', @@ -75,7 +85,15 @@ const EmojiPicker: FC = ({
- + ) => { + search(e.target.value) + }} + />