mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-11-03 23:00:31 +01:00 
			
		
		
		
	Allow adding classes to DownloadButton
This commit is contained in:
		@@ -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>
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user