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

import { CURTAIN_COLOR_LOOKUP } from 'app/constants'
import { displayElementImageURL } from 'app/utils/annotation.utils'

export const FullscreenImage = ({ element, media, transitionDuration }) => {
  const color = element.color || CURTAIN_COLOR_LOOKUP.white

  const mediaItem = media.lookup[element.settings.media_id]
  const style = {
    backgroundColor: color.backgroundColor,
    color: color.textColor,
    transitionDuration,
  }
  
  let url = displayElementImageURL(element, mediaItem)
  if (!url) {
    return <div />
  }

  return (
    <div
      className='fullscreen-element image'
      style={style}
    >
      <div style={{
        backgroundImage: 'url(' + url + ')',
      }} />
    </div>
  )
}