ant-design/components/transfer/operation.jsx
Bruce Mitchener 50a2163518 Don't directly import Component, use React.Component.
This is another step towards making the code internally consistent.
2016-03-26 16:22:39 +07:00

53 lines
1.2 KiB
JavaScript

import React, { PropTypes } from 'react';
import Button from '../button';
import Icon from '../icon';
function noop() {
}
export default class TransferOperation extends React.Component {
render() {
const {
moveToLeft,
moveToRight,
leftArrowText,
rightArrowText,
leftActive,
rightActive,
className,
} = this.props;
const moveToLeftButton = (
<Button type="primary" size="small" disabled={!leftActive} onClick={moveToLeft}>
{<span><Icon type="left" />{leftArrowText}</span>}
</Button>
);
const moveToRightButton = (
<Button type="primary" size="small" disabled={!rightActive} onClick={moveToRight}>
{<span>{rightArrowText}<Icon type="right" /></span>}
</Button>
);
return (
<div className={className}>
{moveToLeftButton}
{moveToRightButton}
</div>
);
}
}
TransferOperation.defaultProps = {
leftArrowText: '',
rightArrowText: '',
moveToLeft: noop,
moveToRight: noop,
};
TransferOperation.propTypes = {
className: PropTypes.string,
leftArrowText: PropTypes.string,
rightArrowText: PropTypes.string,
moveToLeft: PropTypes.func,
moveToRight: PropTypes.func,
};