[MM-55293 & MM-36719] Updating emoji icon on hover and on popover (#25440)

Этот коммит содержится в:
Asaad Mahmood
2023-11-23 11:07:27 +05:00
коммит произвёл GitHub
родитель 70e3a01f2d
Коммит 7848ea8e19
7 изменённых файлов: 83 добавлений и 4 удалений

Просмотреть файл

@@ -6,6 +6,7 @@ import React from 'react';
import type {Emoji} from '@mattermost/types/emojis'; import type {Emoji} from '@mattermost/types/emojis';
import Permissions from 'mattermost-redux/constants/permissions'; import Permissions from 'mattermost-redux/constants/permissions';
import {getEmojiImageUrl} from 'mattermost-redux/utils/emoji_utils';
import OverlayTrigger from 'components/overlay_trigger'; import OverlayTrigger from 'components/overlay_trigger';
import ChannelPermissionGate from 'components/permissions_gates/channel_permission_gate'; import ChannelPermissionGate from 'components/permissions_gates/channel_permission_gate';
@@ -100,6 +101,13 @@ export default class PostRecentReactions extends React.PureComponent<Props, Stat
id='post_info.emoji.tooltip' id='post_info.emoji.tooltip'
className='hidden-xs' className='hidden-xs'
> >
<div>
<img
className='Reaction__emoji Reaction__emoji--large'
src={getEmojiImageUrl(emoji)}
width={48}
/>
</div>
{this.emojiName(emoji, this.props.locale)} {this.emojiName(emoji, this.props.locale)}
</Tooltip> </Tooltip>
} }

Просмотреть файл

@@ -13,6 +13,12 @@ exports[`components/post_view/Reaction should apply read-only class if user does
canAddReactions={false} canAddReactions={false}
canRemoveReactions={true} canRemoveReactions={true}
currentUserReacted={false} currentUserReacted={false}
emojiIcon={
<img
className="Reaction__emoji emoticon"
src="emoji_image_url"
/>
}
emojiName="smile" emojiName="smile"
reactions={ reactions={
Array [ Array [
@@ -97,6 +103,12 @@ exports[`components/post_view/Reaction should apply read-only class if user does
canAddReactions={true} canAddReactions={true}
canRemoveReactions={false} canRemoveReactions={false}
currentUserReacted={true} currentUserReacted={true}
emojiIcon={
<img
className="Reaction__emoji emoticon"
src="emoji_image_url"
/>
}
emojiName="smile" emojiName="smile"
reactions={ reactions={
Array [ Array [
@@ -181,6 +193,12 @@ exports[`components/post_view/Reaction should match snapshot 1`] = `
canAddReactions={true} canAddReactions={true}
canRemoveReactions={true} canRemoveReactions={true}
currentUserReacted={false} currentUserReacted={false}
emojiIcon={
<img
className="Reaction__emoji emoticon"
src="emoji_image_url"
/>
}
emojiName="smile" emojiName="smile"
reactions={ reactions={
Array [ Array [
@@ -265,6 +283,12 @@ exports[`components/post_view/Reaction should match snapshot when a current user
canAddReactions={true} canAddReactions={true}
canRemoveReactions={true} canRemoveReactions={true}
currentUserReacted={true} currentUserReacted={true}
emojiIcon={
<img
className="Reaction__emoji emoticon"
src="emoji_image_url"
/>
}
emojiName="smile" emojiName="smile"
reactions={ reactions={
Array [ Array [

Просмотреть файл

@@ -1,6 +1,14 @@
@import 'sass/utils/mixins'; @import 'sass/utils/mixins';
@import 'sass/utils/functions'; @import 'sass/utils/functions';
.reaction-emoji--large img {
width: 48px;
max-width: none;
height: 48px;
max-height: none;
margin: 4px 0;
}
.Reaction { .Reaction {
@include button-style--none; @include button-style--none;
@@ -63,6 +71,14 @@
margin: 0 2px 0 0; margin: 0 2px 0 0;
object-fit: contain; object-fit: contain;
vertical-align: middle; vertical-align: middle;
&--large {
width: 48px;
max-width: none;
height: 48px;
max-height: none;
margin: 4px 0;
}
} }
&__emoji--post-menu { &__emoji--post-menu {

Просмотреть файл

@@ -210,6 +210,13 @@ export default class Reaction extends React.PureComponent<Props, State> {
ariaLabelEmoji = `${Utils.localizeMessage('reaction.removeReact.ariaLabel', 'remove reaction')} ${emojiNameWithSpaces}`; ariaLabelEmoji = `${Utils.localizeMessage('reaction.removeReact.ariaLabel', 'remove reaction')} ${emojiNameWithSpaces}`;
} }
const emojiIcon = (
<img
className='Reaction__emoji emoticon'
src={this.props.emojiImageUrl}
/>
);
return ( return (
<OverlayTrigger <OverlayTrigger
delayShow={500} delayShow={500}
@@ -222,6 +229,7 @@ export default class Reaction extends React.PureComponent<Props, State> {
canRemoveReactions={canRemoveReactions} canRemoveReactions={canRemoveReactions}
currentUserReacted={currentUserReacted} currentUserReacted={currentUserReacted}
emojiName={emojiName} emojiName={emojiName}
emojiIcon={emojiIcon}
reactions={reactions} reactions={reactions}
/> />
</Tooltip> </Tooltip>
@@ -236,10 +244,7 @@ export default class Reaction extends React.PureComponent<Props, State> {
ref={this.reactionButtonRef} ref={this.reactionButtonRef}
> >
<span className='d-flex align-items-center'> <span className='d-flex align-items-center'>
<img {emojiIcon}
className='Reaction__emoji emoticon'
src={this.props.emojiImageUrl}
/>
<span <span
ref={this.reactionCountRef} ref={this.reactionCountRef}
className='Reaction__count' className='Reaction__count'

Просмотреть файл

@@ -11,6 +11,7 @@ type Props = {
canRemoveReactions: boolean; canRemoveReactions: boolean;
currentUserReacted: boolean; currentUserReacted: boolean;
emojiName: string; emojiName: string;
emojiIcon: React.ReactNode;
reactions: ReactionType[]; reactions: ReactionType[];
users: string[]; users: string[];
}; };
@@ -20,6 +21,7 @@ const ReactionTooltip: React.FC<Props> = (props: Props) => {
canAddReactions, canAddReactions,
canRemoveReactions, canRemoveReactions,
currentUserReacted, currentUserReacted,
emojiIcon,
emojiName, emojiName,
reactions, reactions,
users, users,
@@ -130,6 +132,7 @@ const ReactionTooltip: React.FC<Props> = (props: Props) => {
return ( return (
<> <>
<div className='reaction-emoji--large'>{emojiIcon}</div>
{tooltip} {tooltip}
<br/> <br/>
{clickTooltip} {clickTooltip}

Просмотреть файл

@@ -544,6 +544,10 @@ $emoji-footer-height: $emoji-footer-border-width + $emoji-half-height + $emoji-
&.selected, &.selected,
&:hover { &:hover {
background-color: rgba(var(--center-channel-color-rgb), 0.16); background-color: rgba(var(--center-channel-color-rgb), 0.16);
img {
transform: scale(1.35);
}
} }
&:active { &:active {
@@ -556,6 +560,8 @@ $emoji-footer-height: $emoji-footer-border-width + $emoji-half-height + $emoji-
img { img {
position: relative; position: relative;
transform: scale(1);
transition: transform 0.2s ease-in-out;
&.emoji-category--custom { &.emoji-category--custom {
top: auto; top: auto;

Просмотреть файл

@@ -6,6 +6,10 @@
pointer-events: none; pointer-events: none;
word-wrap: break-word; word-wrap: break-word;
&.in {
opacity: 1;
}
&#announcement-bar__tooltip { &#announcement-bar__tooltip {
width: 50%; width: 50%;
max-width: 100%; max-width: 100%;
@@ -15,6 +19,7 @@
.tooltip-inner { .tooltip-inner {
max-width: 100%; max-width: 100%;
padding: 4px 8px; padding: 4px 8px;
background: rgba(0, 0, 0, 0.9);
box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
font-size: 12px; font-size: 12px;
font-weight: 600; font-weight: 600;
@@ -23,6 +28,18 @@
word-break: break-word; word-break: break-word;
} }
&.top {
.tooltip-arrow {
box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}
}
&.bottom {
.tooltip-arrow {
box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}
}
&.text-nowrap { &.text-nowrap {
.tooltip-inner { .tooltip-inner {
white-space: nowrap; white-space: nowrap;