summaryrefslogtreecommitdiff
path: root/animism-align/frontend/views/align/components/annotations/annotationForms/annotationForm.image.js
blob: e2df98b91ece0f24777579466abc5e3343d9338a (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
import React, { Component } from 'react'

import { Select } from '../../../../../common'

export const AnnotationFormImage = ({ annotation, media, handleSettingsSelect }) => {
  if (!media.lookup) return <div />
  const { lookup, order } = media
  const image_list_items = order.filter(id => lookup[id].type === 'image').map(id => {
    const image = lookup[id]
    return {
      name: image.id,
      label: image.author + ' - ' + image.title
    }
  })
  return (
    <div>
      <Select
        name='media_id'
        className="media_id"
        selected={annotation.settings.media_id}
        options={image_list_items}
        defaultOption='Choose an image'
        onChange={handleSettingsSelect}
      />
    </div>
  )
}