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>
|
<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"
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user