apeman-react-list
Version:
apeman react package for list component.
67 lines (52 loc) • 1.27 kB
JSX
/**
* List item arrow icon component.
* @class ApListItemArrowIcon
*/
import React, {PropTypes as types} from 'react'
import classnames from 'classnames'
import ApListItemIcon from './ap_list_item_icon'
import {shallowEqual} from 'asobj'
/** @lends ApListItemArrowIcon */
const ApListItemArrowIcon = React.createClass({
// --------------------
// Specs
// --------------------
propTypes: {
direction: types.oneOf([
'up',
'down',
'right',
'left'
])
},
mixins: [],
statics: {},
getInitialState () {
return {}
},
getDefaultProps () {
return {
direction: 'right'
}
},
render () {
const s = this
let { props } = s
let className = classnames('ap-list-item-arrow-icon', `fa fa-angle-${props.direction}`, props.className)
return (
<ApListItemIcon className={ className }
style={ Object.assign({}, props.style) }>
</ApListItemIcon>
)
},
// --------------------
// Lifecycle
// --------------------
shouldComponentUpdate (nextProps, nextState) {
const s = this
let { props, state } = s
return !shallowEqual(props, nextProps) || shallowEqual(state, nextState)
}
})
export default ApListItemArrowIcon