summaryrefslogtreecommitdiff
path: root/frontend/src/components/app/timeline/PlayButtonComponent.js
blob: 1a9b0ced64730b0d96bf16c8faa571b4a7c9970b (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;