HoverCard: Handle delay in JS instead of CSS

timeline-tab-hover-styles
Alex Gleason 2020-08-02 23:47:19 -05:00
rodzic 5081dd73c0
commit 35c9574c2f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -20,6 +20,7 @@ import PollContainer from 'soapbox/containers/poll_container';
import { NavLink } from 'react-router-dom';
import ProfileHoverCardContainer from '../features/profile_hover_card/profile_hover_card_container';
import { isMobile } from '../../../app/soapbox/is_mobile';
import { debounce } from 'lodash';
// We use the component (and not the container) since we do not want
// to use the progress bar to show download progress
@ -252,11 +253,16 @@ class Status extends ImmutablePureComponent {
this.handleToggleMediaVisibility();
}
showProfileCard = debounce(() => {
this.setState({ profileCardVisible: true });
}, 1200);
handleProfileHover = e => {
if (!isMobile(window.innerWidth)) this.setState({ profileCardVisible: true });
if (!isMobile(window.innerWidth)) this.showProfileCard();
}
handleProfileLeave = e => {
this.showProfileCard.cancel();
if (!isMobile(window.innerWidth)) this.setState({ profileCardVisible: false });
}

Wyświetl plik

@ -13,7 +13,6 @@
opacity: 0;
transition-property: opacity;
transition-duration: 0.2s;
transition-delay: 0.7s;
width: 320px;
z-index: 998;
left: -10px;