Skip to content

Commit

Permalink
feat: confirm button with enter
Browse files Browse the repository at this point in the history
  • Loading branch information
gicharujohn committed Aug 16, 2022
1 parent f99d571 commit e20239e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/components/Popup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@
export let goBack: boolean = false;
export let confirmText = 'Confirm';
export let okDisabled = false;
function onKey(event: any) {
switch (event.key) {
case 'Enter':
if (!okDisabled) dispatch('confirm');
break;
}
}
</script>

<!-- <div transition:fade|local class="darker" /> -->
<div class="popup-holder" transition:fade|local>
<div class="popup-holder" transition:fade|local on:keyup={onKey}>
<div class="popup bg-white dark:bg-dark-blue">
<div class="pcontainer">
<div class="popuptitle">{title}</div>
Expand Down

0 comments on commit e20239e

Please sign in to comment.