From 554e320c8c9176bbf8b2c29eb12ac0942a2c9d2d Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Thu, 18 Mar 2021 21:44:24 +0530 Subject: [PATCH] added type definations to confirm dailog component --- src/components/ConfirmDialog.tsx | 21 +++++++++++++++------ src/components/Sidebar.tsx | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/components/ConfirmDialog.tsx b/src/components/ConfirmDialog.tsx index a91443a3a..3616b7154 100644 --- a/src/components/ConfirmDialog.tsx +++ b/src/components/ConfirmDialog.tsx @@ -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; + action: string; + show: boolean; + onHide: MouseEventHandler; +} +function ConfirmDialog(props: Props) { + const { callback, action, ...rest } = props; return ( {constants.CLOSE} - + {action && ( + + )} ); diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 62dc8c20b..25323eff7 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -79,7 +79,7 @@ export default function Sidebar(props: Props) { }); }; - let callback = []; + let callback = new Map(); callback[Action.logout] = logout; callback[Action.cancelSubscription] = cancelSubscription; function openFeedbackURL() {