fix(common): show buttons only if onConfirm is passed instead of having separate boolean

This commit is contained in:
2025-12-29 19:58:59 +01:00
parent 25a15f9c65
commit b70bf6d6b2
2 changed files with 3 additions and 9 deletions

View File

@@ -48,7 +48,7 @@ onUnmounted(() => {
<template> <template>
<Buttons <Buttons
v-if="state.showButtons" v-if="state.onConfirm"
:y-offset="state.modalButtonsYOffset" :y-offset="state.modalButtonsYOffset"
b-label="Cancel" b-label="Cancel"
a-label="Confirm" a-label="Confirm"

View File

@@ -15,22 +15,16 @@ const state = useState("confirmationModal", () =>
modalButtonsYOffset: BUTTONS_MAX_Y_OFFSET, modalButtonsYOffset: BUTTONS_MAX_Y_OFFSET,
isVisible: false, isVisible: false,
isClosing: false, isClosing: false,
showButtons: true,
}), }),
); );
const open = ( const open = (options: { text: string; onConfirm?: () => void }) => {
options: {
text: string;
} & ({ showButtons?: true; onConfirm: () => void } | { showButtons: false }),
) => {
gsap.killTweensOf(state.value); gsap.killTweensOf(state.value);
state.value.text = options.text; state.value.text = options.text;
state.value.onConfirm = options.showButtons ? options.onConfirm : null; state.value.onConfirm = options.onConfirm ?? null;
state.value.isVisible = true; state.value.isVisible = true;
state.value.isClosing = false; state.value.isClosing = false;
state.value.isOpen = true; state.value.isOpen = true;
state.value.showButtons = options.showButtons ?? false;
gsap gsap
.timeline() .timeline()