summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/viewer/player/components.inline/inline.gallery.js
blob: eb43e23fcca49dfc51c794717e995c47011a44d2 (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
import React from 'react'

import { CURTAIN_COLOR_LOOKUP } from 'app/constants'
import { MediaCitation, Vitrine, Gallery } from '../components.utility'

export const InlineVitrine = ({ paragraph, media, currentParagraph, currentAnnotation, onAnnotationClick, onDoubleClick }) => {
  const annotation = paragraph.annotations[0]
  const item = media.lookup[annotation.settings.media_id]
  const color = CURTAIN_COLOR_LOOKUP[annotation.settings.color] || CURTAIN_COLOR_LOOKUP.white
  const style = {
    backgroundColor: color.backgroundColor,
    color: color.textColor,
  }
  return (
    <div
      className='inline-element media vitrine'
      style={style}
    >
      {annotation.settings.title && <div className='heading'>{annotation.settings.title}</div>}
      <Vitrine media={item} />
      <MediaCitation media={item} />
    </div>
  )
}

export const InlineGallery = ({ paragraph, media, currentParagraph, currentAnnotation, onAnnotationClick, onDoubleClick }) => {
  const annotation = paragraph.annotations[0]
  const item = media.lookup[annotation.settings.media_id]
  const color = CURTAIN_COLOR_LOOKUP[annotation.settings.color] || CURTAIN_COLOR_LOOKUP.white
  const style = {
    backgroundColor: color.backgroundColor,
    color: color.textColor,
  }

  return (
    <div
      className='inline-element media gallery'
    >
      <div style={style} className='gallery-container'>
        <Gallery media={item} />
      </div>
      <MediaCitation media={item} />
    </div>
  )
}