25 lines
481 B
JavaScript
25 lines
481 B
JavaScript
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
|
|
};
|