Added pulse animation to new peer joining
parent
d5e3027106
commit
b56cbe7ae2
|
|
@ -1,27 +1,38 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import classnames from 'classnames';
|
||||||
import * as stateActions from '../redux/stateActions';
|
import * as stateActions from '../redux/stateActions';
|
||||||
|
|
||||||
class HiddenPeers extends Component
|
class HiddenPeers extends Component
|
||||||
{
|
{
|
||||||
state = {
|
constructor(props)
|
||||||
controlsVisible : false
|
|
||||||
};
|
|
||||||
|
|
||||||
handleMouseOver = () =>
|
|
||||||
{
|
{
|
||||||
this.setState({
|
super(props);
|
||||||
controlsVisible : true
|
this.state = { className: '' };
|
||||||
});
|
}
|
||||||
};
|
|
||||||
|
|
||||||
handleMouseOut = () =>
|
componentDidUpdate(prevProps)
|
||||||
{
|
{
|
||||||
this.setState({
|
const { hiddenPeersCount } = this.props;
|
||||||
controlsVisible : false
|
|
||||||
});
|
if (hiddenPeersCount !== prevProps.hiddenPeersCount)
|
||||||
};
|
{
|
||||||
|
// eslint-disable-next-line react/no-did-update-set-state
|
||||||
|
this.setState({ className: 'pulse' }, () =>
|
||||||
|
{
|
||||||
|
if (this.timeout)
|
||||||
|
{
|
||||||
|
clearTimeout(this.timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.timeout = setTimeout(() =>
|
||||||
|
{
|
||||||
|
this.setState({ className: '' });
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render()
|
render()
|
||||||
{
|
{
|
||||||
|
|
@ -33,11 +44,12 @@ class HiddenPeers extends Component
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-component='HiddenPeers'
|
data-component='HiddenPeers'
|
||||||
|
className={this.state.className}
|
||||||
onMouseOver={this.handleMouseOver}
|
onMouseOver={this.handleMouseOver}
|
||||||
onMouseOut={this.handleMouseOut}
|
onMouseOut={this.handleMouseOut}
|
||||||
>
|
>
|
||||||
<div data-component='HiddenPeersView'>
|
<div data-component='HiddenPeersView'>
|
||||||
<div className='view-container' onClick={() => openUsersTab()}>
|
<div className={classnames('view-container', this.state.className)} onClick={() => openUsersTab()}>
|
||||||
<p>+{hiddenPeersCount} <br /> participant
|
<p>+{hiddenPeersCount} <br /> participant
|
||||||
{(hiddenPeersCount === 1) ? null : 's'}
|
{(hiddenPeersCount === 1) ? null : 's'}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
> .info {
|
> .info {
|
||||||
$backgroundTint = #000;
|
$backgroundTint = #000;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
@ -16,13 +17,15 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
> .view-container {
|
> .view-container {
|
||||||
width: 12vmin;
|
width: 12vmin;
|
||||||
height: 9vmin;
|
height: 9vmin;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 3%;
|
bottom: 3%;
|
||||||
right: 3%;
|
right: 3%;
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
|
cursor: pointer;
|
||||||
background-image: url('/resources/images/buddy.svg');
|
background-image: url('/resources/images/buddy.svg');
|
||||||
background-color: rgba(#2a4b58, 1);
|
background-color: rgba(#2a4b58, 1);
|
||||||
background-position: bottom;
|
background-position: bottom;
|
||||||
|
|
@ -32,34 +35,59 @@
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
line-height: 1.8vmin;
|
line-height: 1.8vmin;
|
||||||
font-size: 1.7vmin;
|
font-size: 1.7vmin;
|
||||||
|
font-weight: bolder;
|
||||||
|
animation: none;
|
||||||
|
|
||||||
|
&.pulse {
|
||||||
|
animation: pulse 1s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.view-container>p{
|
.view-container>p{
|
||||||
transform: translate(0%,50%);
|
transform: translate(0%,50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.view-container,
|
.view-container,
|
||||||
.view-container::before,
|
.view-container::before,
|
||||||
.view-container::after {
|
.view-container::after {
|
||||||
/* Add shadow to distinguish sheets from one another */
|
/* Add shadow to distinguish sheets from one another */
|
||||||
box-shadow: 2px 1px 1px rgba(0,0,0,0.15);
|
box-shadow: 2px 1px 1px rgba(0,0,0,0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
.view-container::before,
|
.view-container::before,
|
||||||
.view-container::after {
|
.view-container::after {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: #2a4b58;
|
background-color: #2a4b58;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Second sheet of paper */
|
/* Second sheet of paper */
|
||||||
.view-container::before {
|
.view-container::before {
|
||||||
left: .7vmin;
|
left: .7vmin;
|
||||||
top: .7vmin;
|
top: .7vmin;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Third sheet of paper */
|
/* Third sheet of paper */
|
||||||
.view-container::after {
|
.view-container::after {
|
||||||
left: 1.4vmin;
|
left: 1.4vmin;
|
||||||
top: 1.4vmin;
|
top: 1.4vmin;
|
||||||
z-index: -2;
|
z-index: -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0% {
|
||||||
|
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
70% {
|
||||||
|
box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue