summaryrefslogtreecommitdiff
path: root/frontend/src/components/app/timeline/PlayButtonComponent.js
blob: 7968c68da42ed483f4c86a176839a0422801440f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React from 'react'

const PlayButtonComponent = ({
                                 isPlaying,
                                 currentTick,
                                 lastSimulatedTick,
                                 onPlay,
                                 onPause,
                             }) => (
    <div
        className="play-btn"
        onClick={() => {
            if (isPlaying) {
                onPause()
            } else {
                if (currentTick !== lastSimulatedTick) {
                    onPlay()
                }
            }
        }}
    >
        {isPlaying ? (
            <span className="fa fa-pause"/>
        ) : (
            <span className="fa fa-play"/>
        )}
    </div>
)

export default PlayButtonComponent