1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-12-25 00:11: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 = {
href: PropTypes.string.isRequired,
className: PropTypes.string,
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
]),
};
export function DownloadButton({ href, children }) {
return <a href={href} className="btn btn-primary" download>{children}</a>;
DownloadButton.defaultProps = {
className: "btn-primary",
};
export function DownloadButton({ href, className, children }) {
return (
<a
href={href}
className={`btn ${className}`.trim()}
download
>
{children}
</a>
);
}