aboutsummaryrefslogtreecommitdiffstats
path: root/apps/Player/components/Buttons.js
blob: 14452a0462348f0b08f35794f84b38f1dce64229 (plain) (blame)
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
31
32
33
34
import { faStepForward, faStepBackward, faPlay, faStop } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'

const Buttons = ({ current, setCurrent, playlist }) => (
  <>
    <span />
    <div
      className={current !== null && current > 0 ? '' : 'iconOff'}
      onClick={() => { current !== null && current > 0 && setCurrent(c => c - 1) }}
    >
      <FontAwesomeIcon icon={faStepBackward} />
    </div>
    <div
      className={current === null ? 'iconOff' : ''}
      onClick={() => { current !== null && setCurrent(null) }}
    >
      <FontAwesomeIcon icon={faStop} />
    </div>
    <div
      className={current === null ? '' : 'iconOff'}
      onClick={() => { current === null && setCurrent(0) }}
    >
      <FontAwesomeIcon icon={faPlay} />
    </div>
    <div
      className={current !== null && current < playlist.length - 1 ? '' : 'iconOff'}
      onClick={() => { current !== null && current < playlist.length - 1 && setCurrent(c => c + 1) }}
    >
      <FontAwesomeIcon icon={faStepForward} />
    </div>
  </>
)

export default Buttons