mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Add Emoji Picker to Postbox
This commit is contained in:
parent
6ee1de9ffa
commit
8f55fee1c3
@ -3,7 +3,7 @@
|
|||||||
padding: calc(var(--spacer) / 4.5) calc(var(--spacer) / 3);
|
padding: calc(var(--spacer) / 4.5) calc(var(--spacer) / 3);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
top: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
width: auto !important;
|
width: auto !important;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
min-height: 80px;
|
min-height: 80px;
|
||||||
margin-bottom: calc(var(--spacer) / 4);
|
margin-bottom: calc(var(--spacer) / 4);
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.postbox .editable:focus {
|
||||||
|
border-color: var(--brand-white);
|
||||||
}
|
}
|
||||||
|
|
||||||
.postbox .editable:empty:before {
|
.postbox .editable:empty:before {
|
||||||
@ -18,3 +23,7 @@
|
|||||||
.postbox .sendButtonWrap {
|
.postbox .sendButtonWrap {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.postbox .postboxInput {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import React, { useRef, useState } from 'react'
|
import React, { useRef, useState, useEffect } from 'react'
|
||||||
import Button from '@shared/atoms/Button'
|
import Button from '@shared/atoms/Button'
|
||||||
import styles from './Postbox.module.css'
|
import styles from './Postbox.module.css'
|
||||||
import { useOrbis } from '@context/Orbis'
|
import { useOrbis } from '@context/Orbis'
|
||||||
|
import EmojiPicker from './FloatingChat/EmojiPicker'
|
||||||
|
import { EmojiClickData, EmojiStyle } from 'emoji-picker-react'
|
||||||
|
|
||||||
export default function Postbox({
|
export default function Postbox({
|
||||||
id,
|
id,
|
||||||
@ -12,11 +14,16 @@ export default function Postbox({
|
|||||||
id: string
|
id: string
|
||||||
callbackPost: (post: OrbisPostInterface) => void
|
callbackPost: (post: OrbisPostInterface) => void
|
||||||
}) {
|
}) {
|
||||||
const [post, setPost] = useState()
|
const [post, setPost] = useState<string>('')
|
||||||
|
|
||||||
const postBoxArea = useRef(null)
|
const postBoxArea = useRef(null)
|
||||||
const { orbis, account } = useOrbis()
|
const { orbis, account } = useOrbis()
|
||||||
|
|
||||||
|
const onEmojiClick = (emojiData: EmojiClickData) => {
|
||||||
|
setPost((prevInput) => prevInput + emojiData.emoji)
|
||||||
|
postBoxArea.current.innerText += emojiData.emoji
|
||||||
|
}
|
||||||
|
|
||||||
function handleInput(e: any) {
|
function handleInput(e: any) {
|
||||||
setPost(e.currentTarget.innerText)
|
setPost(e.currentTarget.innerText)
|
||||||
const _keyCode = e.nativeEvent.data
|
const _keyCode = e.nativeEvent.data
|
||||||
@ -67,14 +74,17 @@ export default function Postbox({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={styles.postbox}>
|
<div className={styles.postbox}>
|
||||||
<div
|
<div className={styles.postboxInput}>
|
||||||
id="postbox-area"
|
<div
|
||||||
ref={postBoxArea}
|
id="postbox-area"
|
||||||
className={styles.editable}
|
ref={postBoxArea}
|
||||||
contentEditable={true}
|
className={styles.editable}
|
||||||
data-placeholder={placeholder}
|
contentEditable={true}
|
||||||
onInput={(e) => handleInput(e)}
|
data-placeholder={placeholder}
|
||||||
></div>
|
onInput={(e) => handleInput(e)}
|
||||||
|
></div>
|
||||||
|
<EmojiPicker onEmojiClick={onEmojiClick} />
|
||||||
|
</div>
|
||||||
<div className={styles.sendButtonWrap}>
|
<div className={styles.sendButtonWrap}>
|
||||||
<Button
|
<Button
|
||||||
style="primary"
|
style="primary"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
.EmojiPickerReact * {
|
||||||
|
font-family: var(--font-family-base) !important;
|
||||||
|
}
|
||||||
.EmojiPickerReact.epr-dark-theme {
|
.EmojiPickerReact.epr-dark-theme {
|
||||||
--epr-bg-color: var(--background-content) !important;
|
--epr-bg-color: var(--background-content) !important;
|
||||||
--epr-category-label-bg-color: #141414e6 !important;
|
--epr-category-label-bg-color: #141414e6 !important;
|
||||||
@ -6,12 +9,40 @@
|
|||||||
--epr-emoji-size: 24px !important;
|
--epr-emoji-size: 24px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.EmojiPickerReact .epr-search-container input.epr-search {
|
||||||
|
background-color: transparent !important;
|
||||||
|
border-color: var(--border-color) !important;
|
||||||
|
border-radius: var(--border-radius) !important;
|
||||||
|
color: var(--brand-black) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.EmojiPickerReact .epr-search-container input.epr-search:focus {
|
.EmojiPickerReact .epr-search-container input.epr-search:focus {
|
||||||
background-color: var(--epr-search-input-bg-color-active);
|
background-color: var(--epr-search-input-bg-color-active);
|
||||||
border: 1px solid var(--border-color) !important;
|
border-color: var(--brand-black) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.EmojiPickerReact.epr-dark-theme .epr-search-container input.epr-search {
|
||||||
|
color: var(--brand-white) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.EmojiPickerReact.epr-dark-theme .epr-search-container input.epr-search:focus {
|
||||||
|
border-color: var(--brand-white) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.EmojiPickerReact .epr-category-nav > button.epr-cat-btn {
|
.EmojiPickerReact .epr-category-nav > button.epr-cat-btn {
|
||||||
-webkit-filter: hue-rotate(110deg) saturate(2);
|
-webkit-filter: hue-rotate(110deg) saturate(2);
|
||||||
filter: hue-rotate(110deg) saturate(2);
|
filter: hue-rotate(110deg) saturate(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.EmojiPickerReact .epr-body::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.EmojiPickerReact .epr-body {
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
scrollbar-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside.EmojiPickerReact.epr-main {
|
||||||
|
border-width: 0 !important;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user