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

import { EPILEPSY_WARNING, ROMAN_NUMERALS } from 'app/constants'

export const FullscreenCurtain = ({ element, transitionDuration }) => {
  // console.log(element, isEntering)
  const { color } = element
  const style = {
    backgroundColor: color.backgroundColor,
    color: color.textColor,
    transitionDuration,
  }
  let texts = []
  console.log(element)
  switch (element.settings.curtain_style) {
    case 'section_heading':
      texts.push((
        <div key='idx'>{ROMAN_NUMERALS[element.section.index]}{'.'}</div>
      ))
      texts.push((
        <div key='txt' dangerouslySetInnerHTML={{ __html: element.annotation.settings.curtain_text || element.section.title }} />
      ))
      break

    case 'video_title':
      texts.push((
        <i><div key='txt' dangerouslySetInnerHTML={{ __html: element.annotation.settings.curtain_text }} /></i>
      ))
      break

    default:
      texts.push((
        <div key='txt' dangerouslySetInnerHTML={{ __html: element.annotation.settings.curtain_text }} />
      ))
      break
  }
  if (element.settings.flashing_light_warning) {
    texts.push((
      <div key='flashing_light_warning' className='flashing_light_warning'>{EPILEPSY_WARNING}</div>
    ))
  }
  return (
    <div className='fullscreen-element curtain' style={style}>
      <div className='curtain-text'>
        {texts}
      </div>
    </div>
  )
}