summaryrefslogtreecommitdiff
path: root/animism-align/frontend/views/align/components/cursor.component.js
blob: a5ad4388d960078679a5b05cbad53de2d42828e5 (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
import React, { Component } from 'react'

import { ZOOM_STEPS } from '../constants'
import { timestamp } from '../../../util'

const Cursor = ({ timeline }) => {
  const { start_ts, zoom, cursor_ts, duration } = timeline
  const secondsPerPixel = ZOOM_STEPS[zoom] * 0.1
  const y = (cursor_ts - start_ts) / secondsPerPixel
  return (
    <div
      className='cursor'
      style={{
        top: y,
      }}
    >
      <div className='line' />
      <div className='tickLabel'>
        {timestamp(cursor_ts, 1)}
      </div>
    </div>
  )
}

export default Cursor