forked from BoostIO/BoostNote-App
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial emoji reaction in comments
Update comment reactions Update user showcase issue Add joined reaction counts Count reactions on go Update handling of reactions from another user Fix remove reaction to add if not from current user Update comment list and thread item Add reaction counts and update styles Add comment delete cleanup Add support for dynamic reaction count showcase Add with delayed tooltip commponent Refactor Comment reactions common code to a separate component Add CommentEmoji component
- Loading branch information
1 parent
7b96e5f
commit d3eef27
Showing
14 changed files
with
796 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from 'react' | ||
import { Emoji } from 'emoji-mart' | ||
import cc from 'classcat' | ||
import Flexbox from '../../design/components/atoms/Flexbox' | ||
import { IconSize } from '../../design/components/atoms/Icon' | ||
import WithDelayedTooltip from '../../design/components/atoms/WithDelayedTooltip' | ||
|
||
interface EmojiIconProps { | ||
emoji: string | ||
defaultIcon?: string | ||
className?: string | ||
style?: React.CSSProperties | ||
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void | ||
size?: IconSize | ||
tooltip?: React.ReactNode | ||
emojiTextContent?: React.ReactNode | ||
tooltipDelay: number | ||
tooltipSide?: 'right' | 'bottom' | 'bottom-right' | 'top' | ||
} | ||
|
||
const CommentEmoji = ({ | ||
emoji, | ||
defaultIcon, | ||
className, | ||
style, | ||
size = 34, | ||
tooltip, | ||
tooltipDelay = 0, | ||
onClick, | ||
emojiTextContent, | ||
tooltipSide, | ||
}: EmojiIconProps) => { | ||
if (emoji == null && defaultIcon == null) { | ||
return null | ||
} | ||
|
||
return ( | ||
<Flexbox | ||
style={{ marginRight: 5, cursor: 'pointer', ...style }} | ||
flex={'0 0 auto'} | ||
className={cc([onClick != null && 'button', className])} | ||
onClick={onClick} | ||
> | ||
<WithDelayedTooltip | ||
tooltip={tooltip} | ||
tooltipDelay={tooltipDelay} | ||
side={tooltipSide} | ||
> | ||
<Flexbox direction={'row'}> | ||
<Emoji emoji={emoji} set='apple' size={size} /> | ||
{emojiTextContent != null && emojiTextContent} | ||
</Flexbox> | ||
</WithDelayedTooltip> | ||
</Flexbox> | ||
) | ||
} | ||
|
||
export default CommentEmoji |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.