1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-12-26 00:21:36 +01:00

Allow adding classes to DownloadButton

This commit is contained in:
Maciej Lenartowicz 2019-11-29 16:01:53 +01:00
parent fd01bc6f56
commit 1064277cd9

View File

@ -10,12 +10,25 @@ import PropTypes from "prop-types";
DownloadButton.propTypes = { DownloadButton.propTypes = {
href: PropTypes.string.isRequired, href: PropTypes.string.isRequired,
className: PropTypes.string,
children: PropTypes.oneOfType([ children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node), PropTypes.arrayOf(PropTypes.node),
PropTypes.node, PropTypes.node,
]), ]),
}; };
export function DownloadButton({ href, children }) { DownloadButton.defaultProps = {
return <a href={href} className="btn btn-primary" download>{children}</a>; className: "btn-primary",
};
export function DownloadButton({ href, className, children }) {
return (
<a
href={href}
className={`btn ${className}`.trim()}
download
>
{children}
</a>
);
} }