Skip to content

Commit

Permalink
ripple
Browse files Browse the repository at this point in the history
  • Loading branch information
soyjavi committed Jul 29, 2015
1 parent 4d35a66 commit 0b45fca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions components/ripple/index.cjsx
@@ -1,13 +1,15 @@
require './style'
localCSS = require './style'

module.exports = React.createClass

# -- States & Properties
propTypes:
origin : React.PropTypes.object
className : React.PropTypes.string
loading : React.PropTypes.bool
origin : React.PropTypes.object

getDefaultProps: ->
className : ''
loading : false

getInitialState: ->
Expand All @@ -19,16 +21,15 @@ module.exports = React.createClass

componentDidMount: ->
el = @getDOMNode()
for key in ["animationend", "webkitAnimationEnd", "oAnimationEnd", "MSAnimationEnd"]
for key in ['animationend', 'webkitAnimationEnd', 'oAnimationEnd', 'MSAnimationEnd']
el.addEventListener key, (=> @setState className: undefined), false
@setState className: "active" if @props.origin?
@setState className: 'active' if @props.origin?

# -- Render
render: ->
className = @state.className
className += " loading" if @props.loading
<div data-component-ripple
className={className}
className = "#{localCSS.root} #{@props.className} #{@state.className}"
className += ' loading' if @props.loading
<div data-react-toolbox='ripple' className={className}
style={
left : @props.origin?.left,
top : @props.origin?.top,
Expand Down
4 changes: 2 additions & 2 deletions components/ripple/style.styl
@@ -1,6 +1,6 @@
@import "../constants.styl"
@import '../constants'

[data-component-ripple]
:local(.root)
position : absolute
background-color : alpha(WHITE, 0.65)
transform translateX(-50%) translateY(-50%)
Expand Down

0 comments on commit 0b45fca

Please sign in to comment.