2017-11-17 14:38:54 +08:00
|
|
|
import * as React from 'react';
|
2019-11-28 12:34:33 +08:00
|
|
|
import { LeftOutlined, RightOutlined } from '@ant-design/icons';
|
2015-11-26 16:07:11 +08:00
|
|
|
import Button from '../button';
|
|
|
|
|
2016-07-01 20:52:17 +08:00
|
|
|
export interface TransferOperationProps {
|
2016-07-13 11:14:24 +08:00
|
|
|
className?: string;
|
|
|
|
leftArrowText?: string;
|
|
|
|
rightArrowText?: string;
|
2018-06-14 10:53:14 +08:00
|
|
|
moveToLeft?: React.MouseEventHandler<HTMLButtonElement>;
|
|
|
|
moveToRight?: React.MouseEventHandler<HTMLButtonElement>;
|
2016-07-13 11:14:24 +08:00
|
|
|
leftActive?: boolean;
|
|
|
|
rightActive?: boolean;
|
2018-05-28 23:07:43 +08:00
|
|
|
style?: React.CSSProperties;
|
2018-09-15 15:18:59 +08:00
|
|
|
disabled?: boolean;
|
2016-07-01 20:52:17 +08:00
|
|
|
}
|
|
|
|
|
2019-08-05 18:38:10 +08:00
|
|
|
const Operation = ({
|
|
|
|
disabled,
|
|
|
|
moveToLeft,
|
|
|
|
moveToRight,
|
|
|
|
leftArrowText = '',
|
|
|
|
rightArrowText = '',
|
|
|
|
leftActive,
|
|
|
|
rightActive,
|
|
|
|
className,
|
|
|
|
style,
|
|
|
|
}: TransferOperationProps) => (
|
|
|
|
<div className={className} style={style}>
|
|
|
|
<Button
|
|
|
|
type="primary"
|
|
|
|
size="small"
|
|
|
|
disabled={disabled || !rightActive}
|
|
|
|
onClick={moveToRight}
|
2019-11-28 12:34:33 +08:00
|
|
|
icon={<RightOutlined />}
|
2019-08-05 18:38:10 +08:00
|
|
|
>
|
|
|
|
{rightArrowText}
|
|
|
|
</Button>
|
|
|
|
<Button
|
|
|
|
type="primary"
|
|
|
|
size="small"
|
|
|
|
disabled={disabled || !leftActive}
|
|
|
|
onClick={moveToLeft}
|
2019-11-28 12:34:33 +08:00
|
|
|
icon={<LeftOutlined />}
|
2019-08-05 18:38:10 +08:00
|
|
|
>
|
|
|
|
{leftArrowText}
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default Operation;
|