2015-11-26 16:07:11 +08:00
|
|
|
import React, { Component, PropTypes } from 'react';
|
|
|
|
import Button from '../button';
|
2015-12-21 15:29:02 +08:00
|
|
|
import Icon from '../icon';
|
2015-11-26 16:07:11 +08:00
|
|
|
|
|
|
|
function noop() {
|
|
|
|
}
|
|
|
|
|
|
|
|
class TransferOperation extends Component {
|
|
|
|
render() {
|
2015-12-23 22:59:42 +08:00
|
|
|
const { moveToLeft, moveToRight, leftArrowText, rightArrowText, leftActive, rightActive, prefixCls, height } = this.props;
|
2015-11-26 16:07:11 +08:00
|
|
|
|
2015-12-23 22:59:42 +08:00
|
|
|
return <div className={`${prefixCls}`} style={{marginTop: (height + 35) / 2 - 24}}>
|
2015-12-23 19:41:56 +08:00
|
|
|
{ rightArrowText ? <Button type="primary" style={{ 'marginBottom': '4px' }} disabled={ !rightActive ? 'disabled' : false } onClick={moveToRight}>{rightArrowText}<Icon type="right" /></Button> :
|
|
|
|
<Button type="primary" style={{ 'marginBottom': '4px' }} disabled={ !rightActive ? 'disabled' : false } onClick={moveToRight}><Icon type="right" /></Button>}
|
2015-12-21 15:29:02 +08:00
|
|
|
{leftArrowText ? <Button type="primary" disabled={ !leftActive ? 'disabled' : false } onClick={moveToLeft}><Icon type="left" />{leftArrowText}</Button> :
|
|
|
|
<Button type="primary" disabled={ !leftActive ? 'disabled' : false } onClick={moveToLeft}><Icon type="left" /></Button>}
|
2015-11-26 16:07:11 +08:00
|
|
|
</div>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TransferOperation.defaultProps = {
|
|
|
|
prefixCls: 'ant-transfer-operation',
|
|
|
|
leftArrowText: '',
|
|
|
|
rightArrowText: '',
|
2015-12-23 22:59:42 +08:00
|
|
|
height: 150,
|
2015-11-26 16:07:11 +08:00
|
|
|
moveToLeft: noop,
|
|
|
|
moveToRight: noop,
|
|
|
|
};
|
|
|
|
|
|
|
|
TransferOperation.propTypes = {
|
|
|
|
prefixCls: PropTypes.string,
|
|
|
|
leftArrowText: PropTypes.string,
|
|
|
|
rightArrowText: PropTypes.string,
|
|
|
|
moveToLeft: PropTypes.func,
|
|
|
|
moveToRight: PropTypes.func,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default TransferOperation;
|