mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-11-03 23:00:31 +01:00 
			
		
		
		
	Add optional close button to ModalHeader component
This commit is contained in:
		@@ -88,18 +88,21 @@ export function Modal({ shown, setShown, scrollable, size, children }) {
 | 
				
			|||||||
ModalHeader.propTypes = {
 | 
					ModalHeader.propTypes = {
 | 
				
			||||||
    setShown: PropTypes.func.isRequired,
 | 
					    setShown: PropTypes.func.isRequired,
 | 
				
			||||||
    title: PropTypes.string.isRequired,
 | 
					    title: PropTypes.string.isRequired,
 | 
				
			||||||
 | 
					    showCloseButton: PropTypes.bool,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function ModalHeader({ setShown, title }) {
 | 
					export function ModalHeader({ setShown, title, showCloseButton = true }) {
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
        <div className="modal-header">
 | 
					        <div className="modal-header">
 | 
				
			||||||
            <h1 className="modal-title fs-5">{title}</h1>
 | 
					            <h1 className="modal-title fs-5">{title}</h1>
 | 
				
			||||||
 | 
					            {showCloseButton && (
 | 
				
			||||||
                <button
 | 
					                <button
 | 
				
			||||||
                    type="button"
 | 
					                    type="button"
 | 
				
			||||||
                    className="btn-close"
 | 
					                    className="btn-close"
 | 
				
			||||||
                    onClick={() => setShown(false)}
 | 
					                    onClick={() => setShown(false)}
 | 
				
			||||||
                    aria-label={_("Close")}
 | 
					                    aria-label={_("Close")}
 | 
				
			||||||
                />
 | 
					                />
 | 
				
			||||||
 | 
					            )}
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user