1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-11-14 17:35:35 +01:00

Merge branch 'download-button-class' into 'dev'

Allow adding classes to DownloadButton

See merge request turris/reforis/foris-js!51
This commit is contained in:
Maciej Lenartowicz 2019-11-29 16:01:53 +01:00
commit d71f638bd5

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>
);
}