mirror of https://github.com/buster-so/buster.git
pass save events differently
This commit is contained in:
parent
d9bc8d4741
commit
dffc3026cd
|
@ -35,9 +35,7 @@ const SplitterContent: React.FC<{
|
|||
<PopupSplitter />
|
||||
|
||||
<div className="flex items-center space-x-2">
|
||||
<Button variant={'default'} onClick={onReset}>
|
||||
Reset
|
||||
</Button>
|
||||
<Button onClick={onReset}>Reset</Button>
|
||||
<Button
|
||||
className="flex items-center"
|
||||
variant="black"
|
||||
|
@ -58,14 +56,8 @@ const SplitterContent: React.FC<{
|
|||
title="Unsaved changes"
|
||||
isDirty={open}
|
||||
description="Are you sure you want to leave this page?"
|
||||
onOk={() => {
|
||||
onSave();
|
||||
return Promise.resolve();
|
||||
}}
|
||||
onCancel={() => {
|
||||
onReset();
|
||||
return Promise.resolve();
|
||||
}}
|
||||
onOk={onSave}
|
||||
onCancel={onReset}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
|
|
@ -36,7 +36,7 @@ const sizeVariants = {
|
|||
};
|
||||
|
||||
export const buttonVariants = cva(
|
||||
'inline-flex items-center overflow-hidden text-base justify-center gap-1.5 shadow rounded transition-all duration-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed data-[loading=true]:cursor-progress',
|
||||
'inline-flex items-center overflow-hidden text-base justify-center gap-1.5 shadow rounded transition-all duration-300 focus-visible:outline-none disabled:pointer-events-none disabled:cursor-not-allowed data-[loading=true]:cursor-progress',
|
||||
{
|
||||
variants: {
|
||||
variant: buttonTypeClasses,
|
||||
|
|
|
@ -12,9 +12,9 @@ type PreventNavigationProps = {
|
|||
description: string;
|
||||
cancelText?: string;
|
||||
okText?: string;
|
||||
onOk: () => Promise<void>;
|
||||
onCancel: () => Promise<void>;
|
||||
onClose?: () => void;
|
||||
onOk: (() => Promise<void>) | (() => void);
|
||||
onCancel: (() => Promise<void>) | (() => void);
|
||||
onClose?: (() => Promise<void>) | (() => void);
|
||||
doNotLeavePageOnOkay?: boolean;
|
||||
};
|
||||
|
||||
|
@ -108,7 +108,7 @@ export const PreventNavigation: React.FC<PreventNavigationProps> = React.memo(
|
|||
document.querySelectorAll('a').forEach((link) => {
|
||||
link.addEventListener('click', handleClick);
|
||||
});
|
||||
}, 0);
|
||||
}, 5);
|
||||
};
|
||||
|
||||
setLeavingPage(true);
|
||||
|
|
Loading…
Reference in New Issue