todos-contra-el-fuego-web/imports/ui/components/Prompt/Prompt.js
vjrj a1a1b9a801 deps: react-bootstrap 0.31 -> 2 (Bootstrap 5 CSS deferred as debt)
Removes the largest batch of React-19-blocking warnings: the 0.31
components (Grid, FormGroup, ControlLabel, Navbar.Header/Brand, Checkbox,
SafeAnchor) all leaned on legacy context / defaultProps.

29 files converted: Grid->Container, FormGroup/ControlLabel/FormControl/
HelpBlock -> Form.Group/Label/Control/Text, Checkbox -> Form.Check (label
as prop), bsStyle->variant (default->secondary), bsSize->size,
pull-right->float-end. Custom Col.js now re-exports v2's Col; custom
NavItem.js rewritten self-contained (no SafeAnchor/createChainedFunction);
Navigation.js drops react-bootstrap Navbar (raw markup anyway).

CSS stays on Bootstrap 4 (alexwine:bootstrap-4) for now: the BS4->5 jump
is entangled with the jQuery carousel/swipe + navbar-collapse and is
tracked as separate debt in UPGRADE.md. Only .form-label needed a shim
(forms.scss). Browser-verified home carousel+navbar, signup form + terms
checkbox, login form; REST smoke byte-identical.
2026-07-21 12:44:46 +02:00

67 lines
2 KiB
JavaScript

/* eslint-disable react/jsx-indent-props */
/* eslint-disable react/jsx-indent */
/* eslint-disable import/no-absolute-path */
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Modal, Button } from 'react-bootstrap';
import { confirmable } from 'react-confirm';
// https://github.com/haradakunihiko/react-confirm/blob/master/example/react-bootstrap/src/components/Confirmation.js
class Prompt extends Component {
render() {
const {
show,
proceed,
dismiss,
cancel,
confirmation,
okBtn,
cancelBtn,
title,
enableEscape = true
} = this.props;
return (
<div className="static-modal">
<Modal
show={show}
onHide={dismiss}
style={{ opacity: 1 }}
aria-labelledby="ModalHeader"
backdrop={enableEscape ? true : 'static'}
keyboard={enableEscape}
>
{title &&
<Modal.Header closeButton>
<Modal.Title id="ModalHeader">{title}</Modal.Title>
</Modal.Header>
}
<Modal.Body>
<p>{confirmation}</p>
</Modal.Body>
<Modal.Footer>
<Button className="button-l" variant="primary" onClick={proceed}>{okBtn}</Button>
<Button onClick={cancel}>{cancelBtn}</Button>
</Modal.Footer>
</Modal>
</div>
);
}
}
Prompt.propTypes = {
show: PropTypes.bool, // from confirmable. indicates if the dialog is shown or not.
proceed: PropTypes.func, // from confirmable. call to close the dialog with promise resolved.
cancel: PropTypes.func, // from confirmable. call to close the dialog with promise rejected.
dismiss: PropTypes.func, // from confirmable. call to only close the dialog.
confirmation: PropTypes.string, // arguments of your confirm function
title: PropTypes.string,
okBtn: PropTypes.string.isRequired,
cancelBtn: PropTypes.string.isRequired,
enableEscape: PropTypes.bool
};
Prompt.defaultProps = {
};
export default confirmable(Prompt);