summaryrefslogtreecommitdiff
path: root/frontend/app/views/tile/handles/tile.link.js
blob: 4dd4fd4f83201204b3cb2cfe8ece6dae024569c9 (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
import React from 'react'
import { generateTransform, unitsDimension } from 'app/views/tile/tile.utils'

export default function TileScript({ tile, box, bounds, videoBounds, viewing, onMouseDown, onDoubleClick }) {
  // console.log(tile)
  const style = {
    transform: generateTransform(tile, box, bounds, videoBounds),
    opacity: tile.settings.opacity,
  }
  // console.log(generateTransform(tile))
  let className = ['tile', tile.type].join(' ')
  if (tile.target_page_id || (viewing && tile.href)) {
    if (viewing || tile.settings.cursor !== 'unclickable') {
      className += ' ' + (tile.settings.cursor || 'hand_up')
    }
  }

  let content = ""
  className += ' ' + tile.settings.align
  style.width = unitsDimension(tile, 'width', bounds, videoBounds)
  style.height = unitsDimension(tile, 'height', bounds, videoBounds)

  return (
    <div
      className={className}
      onMouseDown={onMouseDown}
      onDoubleClick={onDoubleClick}
      style={style}
    >
      {content}
    </div>
  )
}