diff options
Diffstat (limited to 'web/src/lib/ui/Menu.svelte')
| -rw-r--r-- | web/src/lib/ui/Menu.svelte | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/web/src/lib/ui/Menu.svelte b/web/src/lib/ui/Menu.svelte new file mode 100644 index 0000000..2ca117a --- /dev/null +++ b/web/src/lib/ui/Menu.svelte @@ -0,0 +1,39 @@ +<!-- + A dialog (the reference app's MenuCard): a centered card over a dimmed + backdrop with a Close button. The parent renders its content via the + `children` slot (Svelte 5 render-prop form). +--> +<script lang="ts"> + import type { Snippet } from 'svelte'; + import { t } from '$lib/i18n'; + + let { + open = $bindable(true), + title = '', + children + }: { + open?: boolean; + title?: string; + children?: Snippet; + } = $props(); + + function close() { + open = false; + } +</script> + +{#if open} + <div class="dialog__overlay" role="dialog" aria-modal="true"> + <div class="dialog__card"> + {#if title} + <div class="dialog__title">{title}</div> + {/if} + <div class="dialog__body"> + {@render children?.()} + </div> + <div class="dialog__footer"> + <button class="dialog__close" onclick={close}>{t('close')}</button> + </div> + </div> + </div> +{/if} |
