Files
atom/src/cursor-component.coffee
Nathan Sobo e24196c0ef Require React directly rather than via reactionary
Reactionary is just a tiny helper library that can rely on the react
installed by the requiring application instead.
2014-04-22 17:09:36 -06:00

18 lines
451 B
CoffeeScript

React = require 'react'
{div} = require 'reactionary'
SubscriberMixin = require './subscriber-mixin'
module.exports =
CursorComponent = React.createClass
mixins: [SubscriberMixin]
render: ->
{top, left, height, width} = @props.cursor.getPixelRect()
div className: 'cursor', style: {top, left, height, width}
componentDidMount: ->
@subscribe @props.cursor, 'moved', => @forceUpdate()
componentWillUnmount: ->
@unsubscribe()