react-toolbox/source/components/input.cjsx

36 lines
850 B
CoffeeScript
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

###
@todo
###
module.exports = React.createClass
# -- States & Properties
propTypes:
label : React.PropTypes.string
value : React.PropTypes.string
type : React.PropTypes.string
disabled : React.PropTypes.boolean
onChange : React.PropTypes.function
getDefaultProps: ->
type : "text"
disabled : false
# -- Events
onChange: (event) ->
console.log "onChange"
# -- Render
render: ->
<div data-component="input">
<input
type={@props.type}
value={@props.value}
placeholder={@props.hint} 
disabled={@props.disabled}
required={@props.required} />
<span className="bar"></span>
{ <label>{@props.label}</label> if @props.label }
{ <span className="error">{@props.error}</span> if @props.error }
</div>