diff --git a/app/gabsocial/components/emoji_selector.js b/app/gabsocial/components/emoji_selector.js
index e86775d4b..fcaccdbed 100644
--- a/app/gabsocial/components/emoji_selector.js
+++ b/app/gabsocial/components/emoji_selector.js
@@ -2,22 +2,25 @@ import React from 'react';
import PropTypes from 'prop-types';
import { ALLOWED_EMOJI } from 'gabsocial/utils/emoji_reacts';
import emojify from 'gabsocial/features/emoji/emoji';
+import classNames from 'classnames';
export default class EmojiSelector extends React.Component {
static propTypes = {
onReact: PropTypes.func.isRequired,
+ visible: PropTypes.bool,
}
static defaultProps = {
onReact: () => {},
+ visible: false,
}
render() {
- const { onReact } = this.props;
+ const { onReact, visible } = this.props;
return (
-
+
{ALLOWED_EMOJI.map((emoji, i) => (
-
-
+
+
{
const { me } = this.props;
if (me) {
@@ -108,6 +112,20 @@ class ActionBar extends React.PureComponent {
}
}
+ isMobile = () => window.matchMedia('only screen and (max-width: 895px)').matches;
+
+ handleLikeButtonHover = e => {
+ if (!this.isMobile()) this.setState({ emojiSelectorVisible: true });
+ }
+
+ handleLikeButtonLeave = e => {
+ if (!this.isMobile()) this.setState({ emojiSelectorVisible: false });
+ }
+
+ handleLikeButtonClick = e => {
+ if (this.isMobile()) this.setState({ emojiSelectorVisible: true });
+ }
+
handleReactClick = emoji => {
return e => {
const { me } = this.props;
@@ -185,8 +203,16 @@ class ActionBar extends React.PureComponent {
}
}
+ componentDidMount() {
+ document.addEventListener('click', e => {
+ if (!document.querySelector('.detailed-status__button--favourite').contains(e.target))
+ this.setState({ emojiSelectorVisible: false });
+ });
+ }
+
render() {
const { status, intl, me, isStaff } = this.props;
+ const { emojiSelectorVisible } = this.state;
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));
const mutingConversation = status.get('muted');
@@ -265,8 +291,13 @@ class ActionBar extends React.PureComponent {
text='Boost'
/>
-
-
+
+
diff --git a/app/styles/gabsocial/components/emoji-reacts.scss b/app/styles/gabsocial/components/emoji-reacts.scss
index 8738a0782..24783b3f3 100644
--- a/app/styles/gabsocial/components/emoji-reacts.scss
+++ b/app/styles/gabsocial/components/emoji-reacts.scss
@@ -66,6 +66,11 @@
transition: 0.1s;
z-index: 999;
+ &--visible {
+ opacity: 1;
+ pointer-events: all;
+ }
+
&__emoji {
display: block;
padding: 0;
@@ -90,21 +95,9 @@
}
}
-.detailed-status__button--favourite:hover {
- .emoji-react-selector {
- opacity: 1;
- pointer-events: all;
- }
-}
-
.status__action-bar__counter--favourite {
position: relative;
- &:hover .emoji-react-selector {
- opacity: 1;
- pointer-events: all;
- }
-
@media(max-width: 455px) {
position: static;
}