1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | 'use strict'
|
7 |
|
8 | import React, {PropTypes as types} from 'react'
|
9 | import classnames from 'classnames'
|
10 | import {ApTouchMixin} from 'apeman-react-mixin-touch'
|
11 | import {ApPureMixin} from 'apeman-react-mixin-pure'
|
12 |
|
13 |
|
14 | const ApLabel = React.createClass({
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | propTypes: {
|
21 | htmlFor: types.string
|
22 | },
|
23 |
|
24 | mixins: [
|
25 | ApPureMixin,
|
26 | ApTouchMixin
|
27 | ],
|
28 |
|
29 | statics: {},
|
30 |
|
31 | getInitialState () {
|
32 | return {}
|
33 | },
|
34 |
|
35 | getDefaultProps () {
|
36 | return {
|
37 | htmlFor: null
|
38 | }
|
39 | },
|
40 |
|
41 | render () {
|
42 | const s = this
|
43 | let { props } = s
|
44 |
|
45 | return (
|
46 | <label { ...props }
|
47 | className={ classnames('ap-label', props.className) }
|
48 | htmlFor={ props.htmlFor }
|
49 | >{ props.children }</label>
|
50 | )
|
51 | },
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | getTouchData () {
|
57 | const s = this
|
58 | let { props } = s
|
59 | return props.data
|
60 | }
|
61 | })
|
62 |
|
63 | export default ApLabel
|