UNPKG

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