1 | import React from 'react';
|
2 | import Button from 'bee-button';
|
3 | import Icon from 'bee-icon';
|
4 | import PropTypes from 'prop-types';
|
5 |
|
6 | function noop() {
|
7 | }
|
8 |
|
9 | const propTypes = {
|
10 | className: PropTypes.string,
|
11 | leftArrowText: PropTypes.string,
|
12 | rightArrowText: PropTypes.string,
|
13 | moveToLeft: PropTypes.func,
|
14 | moveToRight: PropTypes.func,
|
15 | leftActive: PropTypes.boolean,
|
16 | rightActive: PropTypes.boolean,
|
17 | }
|
18 |
|
19 | const defaultProps = {
|
20 | leftArrowText: '',
|
21 | rightArrowText: '',
|
22 | moveToLeft: noop,
|
23 | moveToRight: noop,
|
24 | };
|
25 |
|
26 | class TransferOperation extends React.Component{
|
27 |
|
28 | render() {
|
29 | const {
|
30 | moveToLeft,
|
31 | moveToRight,
|
32 | leftArrowText,
|
33 | rightArrowText,
|
34 | leftActive,
|
35 | rightActive,
|
36 | className,
|
37 | renderOperation
|
38 | } = this.props;
|
39 |
|
40 | const moveToLeftButton = (
|
41 | <Button size="sm" disabled={!leftActive} onClick={moveToLeft}>
|
42 | {<span><Icon type="uf-arrow-left" />{leftArrowText}</span>}
|
43 | </Button>
|
44 | );
|
45 | const moveToRightButton = (
|
46 | <Button size="sm" disabled={!rightActive} onClick={moveToRight}>
|
47 | {<span>{rightArrowText}<Icon type="uf-arrow-right" /></span>}
|
48 | </Button>
|
49 | );
|
50 | return (
|
51 | <div className={className}>
|
52 | {moveToLeftButton}
|
53 | {moveToRightButton}
|
54 | {renderOperation()}
|
55 | </div>
|
56 | );
|
57 | }
|
58 | }
|
59 |
|
60 | TransferOperation.propsType = propTypes;
|
61 | TransferOperation.defaultProps = defaultProps;
|
62 | export default TransferOperation; |
\ | No newline at end of file |