From 0b735d94f116ff20907e77d0e745fedba110ccc7 Mon Sep 17 00:00:00 2001 From: Sukhman S Date: Sat, 1 Jul 2023 23:03:29 +0530 Subject: [PATCH] feat: add generic Modal component --- frontend/src/Modal/index.tsx | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 frontend/src/Modal/index.tsx diff --git a/frontend/src/Modal/index.tsx b/frontend/src/Modal/index.tsx new file mode 100644 index 00000000..a6cfda14 --- /dev/null +++ b/frontend/src/Modal/index.tsx @@ -0,0 +1,46 @@ +import * as React from 'react'; + +interface ModalProps { + handleSubmit: () => void; + isCancellable: boolean; + handleCancel?: () => void; + render: () => JSX.Element; + modalState: string; + isError: boolean; +} +const Modal = (props: ModalProps) => { + return ( +
+ {props.render()} +
+
+ + {props.isCancellable && ( + + )} +
+ {props.isError && ( +

+ Please enter a valid API key +

+ )} +
+
+ ); +}; + +export default Modal;