From 3267f56dc3de054a7dbdd6cd83305b92cf16bd61 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Mon, 13 Mar 2023 00:24:28 -0300
Subject: show/hide key

---
 .../src/components/modal/index.tsx                 | 31 ++++++++++++++--------
 1 file changed, 20 insertions(+), 11 deletions(-)

(limited to 'packages/merchant-backoffice-ui/src/components/modal/index.tsx')

diff --git a/packages/merchant-backoffice-ui/src/components/modal/index.tsx b/packages/merchant-backoffice-ui/src/components/modal/index.tsx
index c9c7d0ce5..875e89e92 100644
--- a/packages/merchant-backoffice-ui/src/components/modal/index.tsx
+++ b/packages/merchant-backoffice-ui/src/components/modal/index.tsx
@@ -20,7 +20,7 @@
  */
 
 import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser";
-import { ComponentChildren, h, VNode } from "preact";
+import { ComponentChildren, Fragment, h, VNode } from "preact";
 import { useState } from "preact/hooks";
 import { useInstanceContext } from "../../context/instance.js";
 import { DEFAULT_REQUEST_TIMEOUT } from "../../utils/constants.js";
@@ -65,16 +65,25 @@ export function ConfirmModal({
         <section class="modal-card-body">{children}</section>
         <footer class="modal-card-foot">
           <div class="buttons is-right" style={{ width: "100%" }}>
-            <button class="button " onClick={onCancel}>
-              <i18n.Translate>Cancel</i18n.Translate>
-            </button>
-            <button
-              class={danger ? "button is-danger " : "button is-info "}
-              disabled={disabled}
-              onClick={onConfirm}
-            >
-              <i18n.Translate>{label}</i18n.Translate>
-            </button>
+            {onConfirm ? (
+              <Fragment>
+                <button class="button " onClick={onCancel}>
+                  <i18n.Translate>Cancel</i18n.Translate>
+                </button>
+
+                <button
+                  class={danger ? "button is-danger " : "button is-info "}
+                  disabled={disabled}
+                  onClick={onConfirm}
+                >
+                  <i18n.Translate>{label}</i18n.Translate>
+                </button>
+              </Fragment>
+            ) : (
+              <button class="button " onClick={onCancel}>
+                <i18n.Translate>Close</i18n.Translate>
+              </button>
+            )}
           </div>
         </footer>
       </div>
-- 
cgit v1.2.3

