import {Col, Space, Button} from 'antd';
import {CSSProperties, FC} from 'react';

type Props = {
  offset?: number;
  disableAlign?: boolean;
  onSearch: () => void;
  onExport?: () => void;
};

const colStyle: CSSProperties = {textAlign: 'right'};

const FiterButtonGroup: FC<Props> = function({onSearch, onExport, offset, disableAlign}) {
  return (
    <>
      <Col span={6} style={!disableAlign ? colStyle : void 0} offset={offset}>
        <Space>
          <Button type='primary' onClick={onSearch} data-testid='search_btn'>查询</Button>
          {onExport && <Button type='default' onClick={onExport}>导出</Button>}
        </Space>
      </Col>
    </>
  );
};

export default FiterButtonGroup;
