mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 12:03:58 +00:00
auto close snackbar
This commit is contained in:
@@ -18,6 +18,7 @@ export function initializeAppUpdates() {
|
|||||||
onClick: () => {
|
onClick: () => {
|
||||||
electron.send('downloadUpdate');
|
electron.send('downloadUpdate');
|
||||||
},
|
},
|
||||||
|
autoClose: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
@@ -37,6 +38,7 @@ export function initializeAppUpdates() {
|
|||||||
onClick: () => {
|
onClick: () => {
|
||||||
electron.send('applyUpdate');
|
electron.send('applyUpdate');
|
||||||
},
|
},
|
||||||
|
autoClose: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { openedSnackbars } from '../stores';
|
|||||||
export interface SnackbarButton {
|
export interface SnackbarButton {
|
||||||
label: string;
|
label: string;
|
||||||
onClick: Function;
|
onClick: Function;
|
||||||
|
autoClose?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SnackbarInfo {
|
export interface SnackbarInfo {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (autoClose) setTimeout(handleClose, 3000);
|
if (autoClose) setTimeout(handleClose, 3000);
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
@@ -37,7 +36,15 @@
|
|||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
{#each buttons as button}
|
{#each buttons as button}
|
||||||
<div class="button">
|
<div class="button">
|
||||||
<FormStyledButton value={button.label} on:click={button.onClick} />
|
<FormStyledButton
|
||||||
|
value={button.label}
|
||||||
|
on:click={() => {
|
||||||
|
if (button.autoClose) {
|
||||||
|
handleClose();
|
||||||
|
}
|
||||||
|
button.onClick?.();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
@@ -76,5 +83,4 @@
|
|||||||
.button {
|
.button {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user