diff --git a/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiImg.styles.ts b/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiChar.styles.ts similarity index 100% rename from src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiImg.styles.ts rename to src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiChar.styles.ts diff --git a/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiImg.tsx b/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiChar.tsx similarity index 61% rename from src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiImg.tsx rename to src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiChar.tsx index b1a9392b911..cbc0e804c95 100644 --- a/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiImg.tsx +++ b/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiChar.tsx @@ -21,28 +21,18 @@ import {FC} from 'react'; import {CSSObject} from '@emotion/react'; -import {messageReactionEmoji, reactionImgSize} from './EmojiImg.styles'; - export interface EmojiImgProps { - emojiUrl: string; - emojiName: string; - emojiImgSize?: CSSObject; + emoji: string; + size?: number; styles?: CSSObject; } -const EmojiImg: FC = ({emojiUrl, styles, emojiName, emojiImgSize = reactionImgSize}) => { - return ( - <> - {emojiName} - - ); +export const EmojiChar: FC = ({emoji: unicode, size, styles}) => { + const fontSize = size ? `${size}px` : 'var(--font-size-medium)'; + const style = { + ':after': { + content: `'${unicode}'`, + }, + }; + return ; }; - -export {EmojiImg}; diff --git a/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiPicker.tsx b/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiPicker.tsx index d27e54ebf74..db6ad611c8f 100644 --- a/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiPicker.tsx +++ b/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiPicker.tsx @@ -19,13 +19,12 @@ import {useState, useEffect, useRef, FC, RefObject} from 'react'; -import EmojiPicker, {EmojiClickData, SkinTones} from 'emoji-picker-react'; +import EmojiPicker, {EmojiClickData, EmojiStyle, SkinTones} from 'emoji-picker-react'; import {createPortal} from 'react-dom'; import {useClickOutside} from 'src/script/hooks/useClickOutside'; import {isEnterKey, isEscapeKey} from 'Util/KeyboardUtil'; import {t} from 'Util/LocalizerUtil'; -import {getEmojiUrl} from 'Util/ReactionUtil'; interface EmojiPickerContainerProps { posX: number; @@ -124,9 +123,8 @@ const EmojiPickerContainer: FC = ({ data-uie-name="emoji-picker-dialog" > diff --git a/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiPill.tsx b/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiPill.tsx index 1d0709f3a52..13f6057ecf3 100644 --- a/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiPill.tsx +++ b/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/EmojiPill.tsx @@ -25,9 +25,8 @@ import {useMessageFocusedTabIndex} from 'Components/MessagesList/Message/util'; import {getEmojiTitleFromEmojiUnicode} from 'Util/EmojiUtil'; import {isTabKey} from 'Util/KeyboardUtil'; import {t} from 'Util/LocalizerUtil'; -import {getEmojiUrl} from 'Util/ReactionUtil'; -import {EmojiImg} from './EmojiImg'; +import {EmojiChar} from './EmojiChar'; import { getReactionsButtonCSS, messageReactionButton, @@ -52,7 +51,7 @@ export interface EmojiPillProps { hasUserReacted: boolean; } -const EmojiPill: FC = ({ +export const EmojiPill: FC = ({ emoji, emojiUnicode, emojiCount, @@ -67,7 +66,6 @@ const EmojiPill: FC = ({ }) => { const messageFocusedTabIndex = useMessageFocusedTabIndex(isMessageFocused); const [isOpen, setTooltipVisibility] = useState(false); - const emojiUrl = getEmojiUrl(emojiUnicode); const emojiName = getEmojiTitleFromEmojiUnicode(emojiUnicode); const isActive = hasUserReacted && !isRemovedFromConversation; @@ -83,14 +81,7 @@ const EmojiPill: FC = ({ - +

{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */} @@ -131,18 +122,10 @@ const EmojiPill: FC = ({ } }} > - + {emojiCount} ); }; - -export {EmojiPill}; diff --git a/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/MessageReactions.styles.ts b/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/MessageReactions.styles.ts index 6320dad981c..f5ca29215f1 100644 --- a/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/MessageReactions.styles.ts +++ b/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/MessageReactions.styles.ts @@ -60,7 +60,7 @@ export const messageReactionButton: CSSObject = { }; export const messageReactionButtonTooltip: CSSObject = {display: 'flex', maxWidth: 130, whiteSpace: 'break-spaces'}; -export const messageReactionButtonTooltipImage: CSSObject = {marginRight: 8}; +export const messageReactionButtonTooltipImage: CSSObject = {marginRight: 8, lineHeight: '2.5em'}; export const messageReactionDetailsMargin: CSSObject = {marginRight: '0.4rem'}; export const reactionsCountAlignment: CSSObject = {display: 'flex', alignItems: 'center'}; export const messageReactionButtonTooltipText: CSSObject = {fontSize: '0.7rem'}; @@ -117,7 +117,3 @@ export const getReactionsButtonCSS = (isActive?: boolean, isDisabled?: boolean): }, }; }; - -export const actionMenuEmojiSize = { - width: '16px', -}; diff --git a/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/MessageReactions.tsx b/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/MessageReactions.tsx index 2d613020179..d25866fe4ed 100644 --- a/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/MessageReactions.tsx +++ b/src/script/components/MessagesList/Message/ContentMessage/MessageActions/MessageReactions/MessageReactions.tsx @@ -23,10 +23,9 @@ import {ContentMessage} from 'src/script/entity/message/ContentMessage'; import {KEY} from 'Util/KeyboardUtil'; import {t} from 'Util/LocalizerUtil'; -import {EmojiImg} from './EmojiImg'; -import {reactionImgSize} from './EmojiImg.styles'; +import {EmojiChar} from './EmojiChar'; +import {reactionImgSize} from './EmojiChar.styles'; import {EmojiPickerContainer} from './EmojiPicker'; -import {actionMenuEmojiSize} from './MessageReactions.styles'; import {MessageActionsId} from '../MessageActions'; import {useMessageActionsState} from '../MessageActions.state'; @@ -34,8 +33,6 @@ import {messageActionsMenuButton, getActionsMenuCSS, getIconCSS} from '../Messag const thumbsUpEmoji = '👍'; const likeEmoji = '❤️'; -const thumbsUpEmojiUrl = '/image/emojis/img-apple-64/1f44d.png'; -const likeEmojiUrl = '/image/emojis/img-apple-64/2764-fe0f.png'; const INITIAL_CLIENT_X_POS = 0; const INITIAL_CLIENT_Y_POS = 0; export interface MessageReactionsProps { @@ -172,6 +169,7 @@ const MessageReactions: FC = ({ [handleEmojiKeyDown, handleKeyDown], ); + const emojiSize = 15; return ( <>