fix(common): show buttons only if onConfirm is passed instead of having separate boolean
This commit is contained in:
@@ -48,7 +48,7 @@ onUnmounted(() => {
|
||||
|
||||
<template>
|
||||
<Buttons
|
||||
v-if="state.showButtons"
|
||||
v-if="state.onConfirm"
|
||||
:y-offset="state.modalButtonsYOffset"
|
||||
b-label="Cancel"
|
||||
a-label="Confirm"
|
||||
|
||||
@@ -15,22 +15,16 @@ const state = useState("confirmationModal", () =>
|
||||
modalButtonsYOffset: BUTTONS_MAX_Y_OFFSET,
|
||||
isVisible: false,
|
||||
isClosing: false,
|
||||
showButtons: true,
|
||||
}),
|
||||
);
|
||||
|
||||
const open = (
|
||||
options: {
|
||||
text: string;
|
||||
} & ({ showButtons?: true; onConfirm: () => void } | { showButtons: false }),
|
||||
) => {
|
||||
const open = (options: { text: string; onConfirm?: () => void }) => {
|
||||
gsap.killTweensOf(state.value);
|
||||
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.isClosing = false;
|
||||
state.value.isOpen = true;
|
||||
state.value.showButtons = options.showButtons ?? false;
|
||||
|
||||
gsap
|
||||
.timeline()
|
||||
|
||||
Reference in New Issue
Block a user