mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 17:31:25 +08:00
64b905e9bd
* update icons deps * update all icon ref * fix lint * update snapshot
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import * as React from 'react';
|
|
import { LeftOutlined, RightOutlined } from '@ant-design/icons';
|
|
import Button from '../button';
|
|
|
|
export interface TransferOperationProps {
|
|
className?: string;
|
|
leftArrowText?: string;
|
|
rightArrowText?: string;
|
|
moveToLeft?: React.MouseEventHandler<HTMLButtonElement>;
|
|
moveToRight?: React.MouseEventHandler<HTMLButtonElement>;
|
|
leftActive?: boolean;
|
|
rightActive?: boolean;
|
|
style?: React.CSSProperties;
|
|
disabled?: boolean;
|
|
}
|
|
|
|
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}
|
|
icon={<RightOutlined />}
|
|
>
|
|
{rightArrowText}
|
|
</Button>
|
|
<Button
|
|
type="primary"
|
|
size="small"
|
|
disabled={disabled || !leftActive}
|
|
onClick={moveToLeft}
|
|
icon={<LeftOutlined />}
|
|
>
|
|
{leftArrowText}
|
|
</Button>
|
|
</div>
|
|
);
|
|
|
|
export default Operation;
|