summaryrefslogtreecommitdiff
path: root/frontend/app/views/tile/forms/tile.form.element.video.js
blob: 7220aa9d1db2d6aab803eff931653568817fa576 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import React from 'react'

import {
  TextInput, Slider,
  Select, Checkbox,
} from 'app/common'

import { VIDEO_STYLES } from './tile.constants'

export default function TileVideoForm({ tile, errorFields, parent }) {
  return (
    <div>
      <div className='row imageUrl'>
        <TextInput
          title=""
          placeholder='http://'
          name="url"
          required
          data={tile.settings}
          error={errorFields.has('url')}
          onChange={parent.handleVideoChange}
          autoComplete="off"
        />
      </div>
      <div className='row pair with_checkbox'>
        <Select
          name='video_style'
          selected={tile.settings.video_style || 'none'}
          options={VIDEO_STYLES}
          title=''
          onChange={parent.handleSettingsSelect}
        />
        <Checkbox
          label="Loop"
          name="loop"
          checked={tile.settings.loop}
          onChange={parent.handleSettingsSelect}
          autoComplete="off"
        />
      </div>
      <div className='row pair'>
        <Checkbox
          label="Muted"
          name="muted"
          className='short'
          checked={tile.settings.muted}
          onChange={parent.handleSettingsSelect}
        />
        <Checkbox
          label="Autoadvance"
          name="autoadvance"
          className='short'
          checked={tile.settings.autoadvance}
          onChange={parent.handleSettingsSelect}
        />
      </div>
      {!tile.settings.muted && (
        <Slider
          title='Volume'
          name='volume'
          value={('volume' in tile.settings) ? tile.settings.volume : 1.0}
          onChange={parent.handleSettingsSelect}
          min={0.0}
          max={1.0}
          step={0.01}
        />
      )}
      {tile.settings.loop && (
        <div className='row'>
          <Checkbox
            label="Loop section?"
            className='short'
            name="loop_section"
            checked={tile.settings.loop_section}
            onChange={parent.handleSettingsSelect}
          />
        </div>
      )}
      {tile.settings.loop && tile.settings.loop_section && (
        <div className='row pair'>
          <TextInput
            title="From"
            placeholder='0:00'
            name="loop_start"
            data={tile.settings}
            onChange={parent.handleSettingsChange}
            autoComplete="off"
          />
          <TextInput
            title="To"
            placeholder='0:00'
            name="loop_end"
            data={tile.settings}
            onChange={parent.handleSettingsChange}
            autoComplete="off"
          />
        </div>
      )}
    </div>
  )
}