import React from 'react';
import PropTypes from 'prop-types';

import {createDloadLinkByUrl} from '../utils/download';

/*destructure props object*/
export default function BtnDLoad({url,file,name}) {

    const handleOnClick = () => {
	createDloadLinkByUrl(url,file);
    };

    return (
        <button onClick={handleOnClick}>
	    {name}
        </button>
    );
};

BtnDLoad.propTypes = {
    url: PropTypes.string,
    file: PropTypes.string,
    name: PropTypes.string
};
