added type definations to confirm dailog component
This commit is contained in:
parent
dd18a2175e
commit
554e320c8c
|
@ -1,11 +1,18 @@
|
|||
import React from 'react';
|
||||
import React, { MouseEventHandler } from 'react';
|
||||
import { Button, Modal } from 'react-bootstrap';
|
||||
import constants from 'utils/strings/constants';
|
||||
|
||||
function ConfirmDialog({ callback, action, ...props }) {
|
||||
interface Props {
|
||||
callback?: Map<string, Function>;
|
||||
action: string;
|
||||
show: boolean;
|
||||
onHide: MouseEventHandler<HTMLElement>;
|
||||
}
|
||||
function ConfirmDialog(props: Props) {
|
||||
const { callback, action, ...rest } = props;
|
||||
return (
|
||||
<Modal
|
||||
{...props}
|
||||
{...rest}
|
||||
size="lg"
|
||||
aria-labelledby="contained-modal-title-vcenter"
|
||||
centered
|
||||
|
@ -19,9 +26,11 @@ function ConfirmDialog({ callback, action, ...props }) {
|
|||
<Button variant="secondary" onClick={props.onHide}>
|
||||
{constants.CLOSE}
|
||||
</Button>
|
||||
{action && (
|
||||
<Button variant="danger" onClick={callback[action]}>
|
||||
{constants[String(action).toUpperCase()]}
|
||||
</Button>
|
||||
)}
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
);
|
||||
|
|
|
@ -79,7 +79,7 @@ export default function Sidebar(props: Props) {
|
|||
});
|
||||
};
|
||||
|
||||
let callback = [];
|
||||
let callback = new Map<string, Function>();
|
||||
callback[Action.logout] = logout;
|
||||
callback[Action.cancelSubscription] = cancelSubscription;
|
||||
function openFeedbackURL() {
|
||||
|
|
Loading…
Reference in a new issue