feat(common): change modal open signature and allow to hide buttons
This commit is contained in:
@@ -15,16 +15,22 @@ const state = useState("confirmationModal", () =>
|
||||
modalButtonsYOffset: BUTTONS_MAX_Y_OFFSET,
|
||||
isVisible: false,
|
||||
isClosing: false,
|
||||
showButtons: true,
|
||||
}),
|
||||
);
|
||||
|
||||
const open = (text: string, onConfirm?: (() => void) | null) => {
|
||||
const open = (
|
||||
options: {
|
||||
text: string;
|
||||
} & ({ showButtons?: true; onConfirm: () => void } | { showButtons: false }),
|
||||
) => {
|
||||
gsap.killTweensOf(state.value);
|
||||
state.value.text = text;
|
||||
state.value.onConfirm = onConfirm || null;
|
||||
state.value.text = options.text;
|
||||
state.value.onConfirm = options.showButtons ? 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