Added blink effect on new message
This commit is contained in:
parent
721e993dc2
commit
a1e4ab78cd
@ -43,7 +43,7 @@ export default class App extends React.PureComponent {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="app">
|
<div className="app">
|
||||||
<Toolbar stream={streams[constants.ME]} />
|
<Toolbar messages={messages} stream={streams[constants.ME]} />
|
||||||
<Alerts alerts={alerts} dismiss={dismissAlert} />
|
<Alerts alerts={alerts} dismiss={dismissAlert} />
|
||||||
<Notifications notifications={notifications} />
|
<Notifications notifications={notifications} />
|
||||||
<div id="chat">
|
<div id="chat">
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export default class Chat extends React.PureComponent {
|
|||||||
<div className="chat-header">
|
<div className="chat-header">
|
||||||
<div className="chat-close" onClick={this.handleCloseChat}>
|
<div className="chat-close" onClick={this.handleCloseChat}>
|
||||||
<div className="button button-icon">
|
<div className="button button-icon">
|
||||||
<span className="material-icons">arrow_back</span>
|
<span className="material-icons">arrow_forward</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="chat-title">Chat</div>
|
<div className="chat-title">Chat</div>
|
||||||
|
|||||||
@ -1,13 +1,28 @@
|
|||||||
|
import PropTypes from 'prop-types'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { MessagePropTypes } from './Chat.js'
|
||||||
import { StreamPropType } from './Video.js'
|
import { StreamPropType } from './Video.js'
|
||||||
|
|
||||||
export default class Toolbar extends React.PureComponent {
|
export default class Toolbar extends React.PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
messages: PropTypes.arrayOf(MessagePropTypes).isRequired,
|
||||||
stream: StreamPropType
|
stream: StreamPropType
|
||||||
}
|
}
|
||||||
|
constructor () {
|
||||||
|
super()
|
||||||
|
this.state = {
|
||||||
|
isChatOpen: false,
|
||||||
|
totalMessages: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
handleChatClick = e => {
|
handleChatClick = e => {
|
||||||
|
const { messages } = this.props
|
||||||
document.getElementById('chat').classList.toggle('show')
|
document.getElementById('chat').classList.toggle('show')
|
||||||
e.currentTarget.classList.toggle('on')
|
e.currentTarget.classList.toggle('on')
|
||||||
|
this.setState({
|
||||||
|
isChatOpen: document.getElementById('chat').classList.contains('show'),
|
||||||
|
totalMessages: messages.length
|
||||||
|
})
|
||||||
}
|
}
|
||||||
handleMicClick = e => {
|
handleMicClick = e => {
|
||||||
const { stream } = this.props
|
const { stream } = this.props
|
||||||
@ -58,12 +73,14 @@ export default class Toolbar extends React.PureComponent {
|
|||||||
window.location.href = '/'
|
window.location.href = '/'
|
||||||
}
|
}
|
||||||
render () {
|
render () {
|
||||||
const { stream } = this.props
|
const { messages, stream } = this.props
|
||||||
|
const { isChatOpen, totalMessages } = this.state
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="toolbar active">
|
<div className="toolbar active">
|
||||||
<div onClick={this.handleChatClick}
|
<div onClick={this.handleChatClick}
|
||||||
className="button chat"
|
className="button chat"
|
||||||
|
data-blink={messages.length !== totalMessages && !isChatOpen}
|
||||||
title="Chat"
|
title="Chat"
|
||||||
>
|
>
|
||||||
<span className="material-icons">chat</span>
|
<span className="material-icons">chat</span>
|
||||||
|
|||||||
@ -54,6 +54,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.chat {
|
.chat {
|
||||||
|
&[data-blink="true"] {
|
||||||
|
-webkit-animation: bg-blink 1s infinite;
|
||||||
|
-moz-animation: bg-blink 1s infinite;
|
||||||
|
animation: bg-blink 1s infinite;
|
||||||
|
}
|
||||||
&:hover, &.on {
|
&:hover, &.on {
|
||||||
background: #407cf7;
|
background: #407cf7;
|
||||||
}
|
}
|
||||||
@ -83,3 +88,33 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes bg_blink {
|
||||||
|
50% {
|
||||||
|
background-color: #407cf7;
|
||||||
|
}
|
||||||
|
|
||||||
|
99% {
|
||||||
|
background-color: #407cf7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-moz-keyframes bg-blink {
|
||||||
|
50% {
|
||||||
|
background-color: #407cf7;
|
||||||
|
}
|
||||||
|
|
||||||
|
99% {
|
||||||
|
background-color: #407cf7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes bg-blink {
|
||||||
|
50% {
|
||||||
|
background-color: #407cf7;
|
||||||
|
}
|
||||||
|
|
||||||
|
99% {
|
||||||
|
background-color: #407cf7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user