ant-design/components/transfer/operation.tsx

51 lines
997 B
TypeScript
Raw Normal View History

import React from 'react';
2015-11-26 16:07:11 +08:00
import Button from '../button';
function noop() {
}
export interface TransferOperationProps {
2016-07-13 11:14:24 +08:00
className?: string;
leftArrowText?: string;
rightArrowText?: string;
2016-10-19 17:51:33 +08:00
moveToLeft?: React.FormEventHandler<any>;
moveToRight?: React.FormEventHandler<any>;
2016-07-13 11:14:24 +08:00
leftActive?: boolean;
rightActive?: boolean;
}
export default (props: TransferOperationProps) => {
const {
moveToLeft = noop,
moveToRight = noop,
leftArrowText = '',
rightArrowText = '',
leftActive,
rightActive,
className,
} = props;
return (
<div className={className}>
<Button
type="primary"
size="small"
disabled={!leftActive}
onClick={moveToLeft}
icon="left"
>
{leftArrowText}
2015-12-24 15:23:26 +08:00
</Button>
<Button
type="primary"
size="small"
disabled={!rightActive}
onClick={moveToRight}
icon="right"
>
{rightArrowText}
2015-12-24 15:23:26 +08:00
</Button>
</div>
);
};