summaryrefslogtreecommitdiff
path: root/frontend/app/views/tile/forms/tile.form.element.image.js
blob: 68ef65abb7a894cb86e09d78bfd8a7c75db47426 (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
import React from 'react'

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

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

export default function TileImageForm({ tile, errorFields, parent }) {
  return (
    <div>
      <div className='row imageUrl'>
        {tile.settings.url && <div className='thumb'><img src={tile.settings.url} /></div>}
        <TextInput
          title=""
          placeholder='http://'
          name="url"
          required
          data={tile.settings}
          error={errorFields.has('url')}
          onChange={parent.handleImageChange}
          autoComplete="off"
        />
      </div>
      <div className='row pair'>
        <Checkbox
          label="Tiled"
          name="is_tiled"
          checked={tile.settings.is_tiled}
          onChange={parent.handleSettingsSelect}
          autoComplete="off"
        />
        {tile.settings.is_tiled &&
          <Select
            name='tile_style'
            selected={tile.settings.tile_style || 'tile'}
            options={IMAGE_TILE_STYLES}
            title=''
            onChange={parent.handleSettingsSelect}
          />
        }
      </div>
    </div>
  )
}