From 57055b499bee68b893b74db645cdd1b1f0488d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com> Date: Thu, 17 Nov 2022 22:40:18 +0000 Subject: [PATCH] feat: new conditional buttons support --- .../web/react/components/modal/modal.tsx | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/frontends/web/react/components/modal/modal.tsx b/frontends/web/react/components/modal/modal.tsx index a73a48b1..7740e413 100644 --- a/frontends/web/react/components/modal/modal.tsx +++ b/frontends/web/react/components/modal/modal.tsx @@ -9,6 +9,7 @@ type ModalProps = { title?: string; text?: string; visible?: boolean; + buttons?: boolean; overlayClose?: boolean; style?: string[]; onConfirm?: () => void; @@ -19,6 +20,7 @@ export const Modal: FC<ModalProps> = ({ title = "Alert", text = "Do you confirm the following operation?", visible = false, + buttons = true, overlayClose = true, style = [], onConfirm, @@ -75,20 +77,22 @@ export const Modal: FC<ModalProps> = ({ className="modal-text" dangerouslySetInnerHTML={getTextHtml()} ></p> - <div className="modal-buttons"> - <Button - text={"Cancel"} - size={"medium"} - style={["simple", "red", "border", "padded-large"]} - onClick={onCancel} - /> - <Button - text={"Confirm"} - size={"medium"} - style={["simple", "border", "padded-large"]} - onClick={onConfirm} - /> - </div> + {buttons && ( + <div className="modal-buttons"> + <Button + text={"Cancel"} + size={"medium"} + style={["simple", "red", "border", "padded-large"]} + onClick={onCancel} + /> + <Button + text={"Confirm"} + size={"medium"} + style={["simple", "border", "padded-large"]} + onClick={onConfirm} + /> + </div> + )} </div> </div> ); -- GitLab