From c7716463fc3720b2683be121829812cc5d4a9fc0 Mon Sep 17 00:00:00 2001 From: anoop narang Date: Thu, 23 Jul 2020 11:15:29 +0530 Subject: [PATCH] [INFRA-421] | Anoop | Use confirmation button when submitting manifest --- src/components/common/ConfirmationButton.tsx | 21 ++++++++++++++ src/components/manifest/Form.tsx | 30 ++++---------------- 2 files changed, 27 insertions(+), 24 deletions(-) create mode 100644 src/components/common/ConfirmationButton.tsx diff --git a/src/components/common/ConfirmationButton.tsx b/src/components/common/ConfirmationButton.tsx new file mode 100644 index 0000000..8498189 --- /dev/null +++ b/src/components/common/ConfirmationButton.tsx @@ -0,0 +1,21 @@ +import * as React from 'react'; +import { ButtonProps } from '@material-ui/core'; +import Button from '@material-ui/core/Button'; + +const ConfirmationButton = (props: ButtonProps) => { + const [isAskingForConfirmation, toggleConfirmation] = React.useState(false); + const { className, onClick, ...buttonProps } = props; + const askForConfirmation = () => { + toggleConfirmation(true); + setTimeout(() => toggleConfirmation(false), 3000); + }; + const onConfirmation = (e: any) => { + toggleConfirmation(false); + onClick!(e); + }; + if (isAskingForConfirmation) { + return ; + } + return + - {/* -
-

Manifest Data

-
{formatDisplayData(standaloneData)}
-
-
*/} );