import { Button as AntButton } from 'antd';
import { ElementStatus } from 'types/elements';

const Link = ({ status, url, text, icon: Icon, ...props }) => {
  return (
    <AntButton
      {...props}
      rel="noopener"
      target="_blank"
      href={url}
      disabled={status === ElementStatus.Disabled || !url}
      loading={status === ElementStatus.Loading}
      icon={Icon && <Icon />}
    >
      {text}
    </AntButton>
  );
};

export default Link;
