mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-11-03 23:00:31 +01:00 
			
		
		
		
	Add className prop to CheckBox and Radio components
This commit is contained in:
		@@ -17,17 +17,19 @@ CheckBox.propTypes = {
 | 
				
			|||||||
    helpText: PropTypes.string,
 | 
					    helpText: PropTypes.string,
 | 
				
			||||||
    /** Control if checkbox is clickable */
 | 
					    /** Control if checkbox is clickable */
 | 
				
			||||||
    disabled: PropTypes.bool,
 | 
					    disabled: PropTypes.bool,
 | 
				
			||||||
 | 
					    /** Additional class name */
 | 
				
			||||||
 | 
					    className: PropTypes.string,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CheckBox.defaultProps = {
 | 
					CheckBox.defaultProps = {
 | 
				
			||||||
    disabled: false,
 | 
					    disabled: false,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function CheckBox({ label, helpText, disabled, ...props }) {
 | 
					function CheckBox({ label, helpText, disabled, className, ...props }) {
 | 
				
			||||||
    const uid = useUID();
 | 
					    const uid = useUID();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
        <div className="mb-3 form-check">
 | 
					        <div className={`${className || "mb-3"} form-check`.trim()}>
 | 
				
			||||||
            <input
 | 
					            <input
 | 
				
			||||||
                className="form-check-input"
 | 
					                className="form-check-input"
 | 
				
			||||||
                type="checkbox"
 | 
					                type="checkbox"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -83,12 +83,13 @@ Radio.propTypes = {
 | 
				
			|||||||
    id: PropTypes.string.isRequired,
 | 
					    id: PropTypes.string.isRequired,
 | 
				
			||||||
    inline: PropTypes.bool,
 | 
					    inline: PropTypes.bool,
 | 
				
			||||||
    helpText: PropTypes.string,
 | 
					    helpText: PropTypes.string,
 | 
				
			||||||
 | 
					    className: PropTypes.string,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function Radio({ label, id, helpText, inline, ...props }) {
 | 
					export function Radio({ label, id, helpText, inline, className, ...props }) {
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
        <div
 | 
					        <div
 | 
				
			||||||
            className={`mb-2 ${inline ? "form-check form-check-inline" : ""}`.trim()}
 | 
					            className={`${className || "mb-3"} ${inline ? "form-check form-check-inline" : ""}`.trim()}
 | 
				
			||||||
        >
 | 
					        >
 | 
				
			||||||
            <input
 | 
					            <input
 | 
				
			||||||
                id={id}
 | 
					                id={id}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user