import React from 'react'
import styles from './styles.css'

class Scrollbar extends React.Component {
  constructor() {
    super()
  }
  
  componentDidUpdate() {
    let { scrollHeight, scrollMarginTop } = this.props
    this.scroll.style.height = scrollHeight + 'px'
    this.scroll.style.marginTop = scrollMarginTop + 'px'
  }

  render() {
    return (
      <div className={ styles.scrollbarRail } ref={ x => this.rail = x }>
        <div className={ styles.scrollbar } ref={ x => this.scroll = x }/>
      </div>
    )
  }
}

export default Scrollbar