Reaction and frontpage button fixes

This commit is contained in:
mrfry 2021-05-21 09:28:21 +02:00
parent 6dfb8ebfd3
commit 4cc5dbbcf6
7 changed files with 32 additions and 45 deletions

View file

@ -1,6 +1,5 @@
.comment_bttn { .comment_bttn {
font-size: 15px; font-size: 15px;
padding-top: 4px !important;
transition: width 0.5s, height 0.5s, ease-in 0.5s; transition: width 0.5s, height 0.5s, ease-in 0.5s;
} }
@ -11,9 +10,6 @@
.reply_bttn { .reply_bttn {
font-size: 15px; font-size: 15px;
margin-top: 14.5px !important;
margin-left: 6px !important;
padding-top: 4px !important;
transition: width 0.5s, height 0.5s, ease-in 0.5s; transition: width 0.5s, height 0.5s, ease-in 0.5s;
} }
@ -24,9 +20,6 @@
.delete_bttn { .delete_bttn {
font-size: 15px; font-size: 15px;
margin-top: 14.5px !important;
margin-left: 6px !important;
padding-top: 4px !important;
transition: width 0.5s, height 0.5s, ease-in 0.5s; transition: width 0.5s, height 0.5s, ease-in 0.5s;
} }

View file

@ -29,10 +29,6 @@
.delete_bttn { .delete_bttn {
font-size: 15px; font-size: 15px;
margin-top: 12px !important;
margin-left: 2px !important;
margin-right: 5px !important;
padding-top: 4px !important;
transition: width 0.5s, height 0.5s, ease-in 0.5s; transition: width 0.5s, height 0.5s, ease-in 0.5s;
} }

View file

@ -22,8 +22,7 @@ function useOutsideAlerter(ref, action) {
function ExistingReacts({ existingReacts, onClick, uid }) { function ExistingReacts({ existingReacts, onClick, uid }) {
return ( return (
<div className={styles.reactionContainer}> <>
<div className={styles.react_bttn}>Reakció</div>
{existingReacts && {existingReacts &&
Object.keys(existingReacts).map((key) => { Object.keys(existingReacts).map((key) => {
const currReact = existingReacts[key] const currReact = existingReacts[key]
@ -32,9 +31,9 @@ function ExistingReacts({ existingReacts, onClick, uid }) {
return null return null
} }
return ( return (
<div <span
title={`'${key}': ${currReact.join(', ')}`} title={`'${key}': ${currReact.join(', ')}`}
className={`${currReact.includes(uid) && styles.reacted}`} className={`${currReact.includes(uid) ? styles.reacted : ''}`}
key={key} key={key}
onClick={(e) => { onClick={(e) => {
e.stopPropagation() e.stopPropagation()
@ -42,10 +41,10 @@ function ExistingReacts({ existingReacts, onClick, uid }) {
}} }}
> >
{react.emoji} {currReact.length} {react.emoji} {currReact.length}
</div> </span>
) )
})} })}
</div> </>
) )
} }
@ -90,27 +89,20 @@ export default function ReactButton({ onClick, existingReacts, uid }) {
}) })
return ( return (
<div <>
className={styles.reactContainer}
onClick={() => {
setOpened(true)
}}
onMouseLeave={() => {
// setOpened(false)
}}
>
<Tooltip <Tooltip
text={() => {
return (
<span
onClick={() => {
setOpened(true)
}}
>
Reakció
</span>
)
}}
opened={opened} opened={opened}
text={() => (
<ExistingReacts
uid={uid}
onClick={(key, isDelete) => {
onClick(key, isDelete)
setOpened(false)
}}
existingReacts={existingReacts}
/>
)}
> >
<div ref={wrapperRef} className={styles.reactionContainer}> <div ref={wrapperRef} className={styles.reactionContainer}>
<RenderEmojis <RenderEmojis
@ -121,6 +113,14 @@ export default function ReactButton({ onClick, existingReacts, uid }) {
/> />
</div> </div>
</Tooltip> </Tooltip>
</div> <ExistingReacts
uid={uid}
onClick={(key, isDelete) => {
onClick(key, isDelete)
setOpened(false)
}}
existingReacts={existingReacts}
/>
</>
) )
} }

View file

@ -1,7 +1,6 @@
.reactionContainer { .reactionContainer {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
margin-top: 15px !important;
margin: 4px 2px; margin: 4px 2px;
} }
@ -17,7 +16,7 @@
.reactionContainer > div { .reactionContainer > div {
margin: 2px 2px; margin: 2px 2px;
padding: 0px 10px; padding: 2px 9px;
border: 1px solid #444; border: 1px solid #444;
border-radius: 6px; border-radius: 6px;
cursor: pointer; cursor: pointer;
@ -52,5 +51,4 @@
.react_bttn { .react_bttn {
font-size: 15px; font-size: 15px;
padding-top: 3px !important;
} }

View file

@ -11,7 +11,6 @@
.categoryName { .categoryName {
text-align: center; text-align: center;
margin-top: 85px !important;
margin: 5px 0px; margin: 5px 0px;
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;

View file

@ -3,9 +3,9 @@ import styles from './tooltip.module.css'
export default function Tooltip({ children, text, opened }) { export default function Tooltip({ children, text, opened }) {
return ( return (
<div className={styles.tooltip}> <span className={styles.tooltip}>
{text()} {text && text()}
{opened && <span className={styles.tooltiptext}>{children}</span>} {opened && <span className={styles.tooltiptext}>{children}</span>}
</div> </span>
) )
} }

View file

@ -351,11 +351,12 @@ input:focus {
.actions { .actions {
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap;
} }
.actions > span { .actions > span {
margin: 2px 2px; margin: 2px 2px;
padding: 0px 10px; padding: 4px 10px;
border: 1px solid #444; border: 1px solid #444;
border-radius: 6px; border-radius: 6px;
cursor: pointer; cursor: pointer;