Front page forum

This commit is contained in:
mrfry 2021-03-05 17:07:37 +01:00
parent a09e9734da
commit 561aa21d93
15 changed files with 484 additions and 136 deletions

View file

@ -5,9 +5,6 @@ import Tooltip from './tooltip.js'
import styles from './reactButton.module.css'
import reactions from '../data/reactions.json'
// TODO: fixdis
const breakEvery = 7
function ExistingReacts({ existingReacts, onClick, uid }) {
return (
<div className={styles.reactionContainer}>
@ -24,7 +21,8 @@ function ExistingReacts({ existingReacts, onClick, uid }) {
title={currReact.join(', ')}
className={`${currReact.includes(uid) && styles.reacted}`}
key={key}
onClick={() => {
onClick={(e) => {
e.stopPropagation()
onClick(key, currReact.includes(uid))
}}
>
@ -39,7 +37,6 @@ function ExistingReacts({ existingReacts, onClick, uid }) {
function RenderEmojis({ onClick }) {
const [search, setSearch] = useState('')
let index = 0
return (
<>
<input
@ -55,20 +52,15 @@ function RenderEmojis({ onClick }) {
return null
}
return (
<>
{index++ % breakEvery === 0 && (
<div key={`${key}_break`} className={styles.break} />
)}
<div
title={key}
key={key}
onClick={() => {
onClick(key)
}}
>
{reaction.emoji}
</div>
</>
<div
title={key}
key={key}
onClick={() => {
onClick(key)
}}
>
{reaction.emoji}
</div>
)
})}
</>
@ -81,9 +73,10 @@ export default function ReactButton({ onClick, existingReacts, uid }) {
return (
<div
className={styles.reactContainer}
onMouseEnter={() => {
onClick={() => {
setOpened(true)
}}
onMouseEnter={() => {}}
onMouseLeave={() => {
setOpened(false)
}}
@ -93,7 +86,10 @@ export default function ReactButton({ onClick, existingReacts, uid }) {
text={() => (
<ExistingReacts
uid={uid}
onClick={onClick}
onClick={(key, isDelete) => {
onClick(key, isDelete)
setOpened(false)
}}
existingReacts={existingReacts}
/>
)}