1
- import _ from 'lodash'
2
1
import cx from 'classnames'
2
+ import _ from 'lodash'
3
3
import React , { PropTypes } from 'react'
4
4
5
5
import {
6
- createShorthand ,
7
6
customPropTypes ,
8
7
getElementType ,
9
8
getUnhandledProps ,
@@ -17,14 +16,24 @@ import ItemExtra from './ItemExtra'
17
16
import ItemMeta from './ItemMeta'
18
17
19
18
/**
20
- * An item can contain content
19
+ * An item can contain content.
21
20
*/
22
21
function ItemContent ( props ) {
23
- const { children , className , content , description , extra , header , meta , verticalAlign } = props
24
- const classes = cx (
22
+ const {
23
+ children ,
25
24
className,
25
+ content,
26
+ description,
27
+ extra,
28
+ header,
29
+ meta,
30
+ verticalAlign,
31
+ } = props
32
+
33
+ const classes = cx (
26
34
useVerticalAlignProp ( verticalAlign ) ,
27
35
'content' ,
36
+ className ,
28
37
)
29
38
const rest = getUnhandledProps ( ItemContent , props )
30
39
const ElementType = getElementType ( ItemContent , props )
@@ -35,10 +44,10 @@ function ItemContent(props) {
35
44
36
45
return (
37
46
< ElementType { ...rest } className = { classes } >
38
- { createShorthand ( ItemHeader , val => ( { content : val } ) , header ) }
39
- { createShorthand ( ItemMeta , val => ( { content : val } ) , meta ) }
40
- { createShorthand ( ItemDescription , val => ( { content : val } ) , description ) }
41
- { createShorthand ( ItemExtra , val => ( { content : val } ) , extra ) }
47
+ { ItemHeader . create ( header ) }
48
+ { ItemMeta . create ( meta ) }
49
+ { ItemDescription . create ( description ) }
50
+ { ItemExtra . create ( extra ) }
42
51
{ content }
43
52
</ ElementType >
44
53
)
@@ -48,9 +57,6 @@ ItemContent._meta = {
48
57
name : 'ItemContent' ,
49
58
parent : 'Item' ,
50
59
type : META . TYPES . VIEW ,
51
- props : {
52
- verticalAlign : SUI . VERTICAL_ALIGNMENTS ,
53
- } ,
54
60
}
55
61
56
62
ItemContent . propTypes = {
@@ -78,8 +84,8 @@ ItemContent.propTypes = {
78
84
/** Shorthand for ItemMeta component. */
79
85
meta : customPropTypes . itemShorthand ,
80
86
81
- /** Content can specify its vertical alignment */
82
- verticalAlign : PropTypes . oneOf ( ItemContent . _meta . props . verticalAlign ) ,
87
+ /** Content can specify its vertical alignment. */
88
+ verticalAlign : PropTypes . oneOf ( SUI . VERTICAL_ALIGNMENTS ) ,
83
89
}
84
90
85
91
export default ItemContent
0 commit comments