feat: fix Sheet close behavior

This commit is contained in:
Aleksi Lassila
2025-08-25 14:21:07 +03:00
parent 802f4e3337
commit 7ead9e699f
3 changed files with 19 additions and 8 deletions

View File

@@ -7,4 +7,6 @@
./**/dist
backend/plugins
wireguard
wireguard
./**/torrent-stream-downloads

View File

@@ -5,6 +5,7 @@
import IconButton from '../FloatingIconButton.svelte';
import { Cross1 } from 'radix-icons-svelte';
import classNames from 'classnames';
import Container from '../Container.svelte';
export let size: 'sm' | 'md' | 'lg' = 'md';
export let showCloseButton: boolean = true;
@@ -18,13 +19,21 @@
}
$: sizeClasses = {
'sm': 'max-w-xs w-full',
'md': 'max-w-sm w-full',
'lg': 'max-w-md w-full'
sm: 'max-w-xs w-full',
md: 'max-w-sm w-full',
lg: 'max-w-md w-full'
}[size];
</script>
<Modal on:close={handleClose} let:close>
<Container
trapFocus
focusOnMount
class={classNames('fixed inset-0', $$restProps.class)}
on:back={({ detail: e }) => {
handleClose();
e.stopPropagation();
}}
>
<!-- Backdrop -->
<div
class="fixed inset-0 bg-primary-900/75 flex justify-end"
@@ -58,4 +67,4 @@
</div>
</div>
</div>
</Modal>
</Container>

View File

@@ -96,7 +96,7 @@
}
</script>
<Sheet on:close={handleClose} size="md" let:close>
<Sheet on:close={handleClose} size="md">
<div class="space-y-6">
<div class="rounded-xl overflow-hidden">
<LazyImg src={imgUrl} />
@@ -112,7 +112,7 @@
type="primary-dark"
action={async () => {
await handleStream();
close();
handleClose();
}}
let:loading
>