chore: remove unused element_data_store_v2.svelte
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { onMount, onDestroy, run } from 'svelte/legacy';
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
open?: boolean;
|
||||
@@ -8,6 +8,9 @@
|
||||
size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl';
|
||||
placement?: 'top-center' | 'center' | 'bottom-center';
|
||||
class_li?: string; // Additional classes for the dialog
|
||||
header?: import('svelte').Snippet;
|
||||
children?: import('svelte').Snippet;
|
||||
footer?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -16,13 +19,16 @@
|
||||
autoclose = true,
|
||||
size = 'md',
|
||||
placement = 'center',
|
||||
class_li = ''
|
||||
class_li = '',
|
||||
header,
|
||||
children,
|
||||
footer
|
||||
}: Props = $props();
|
||||
|
||||
let dialog_element: HTMLDialogElement;
|
||||
|
||||
// Open/close dialog reactively
|
||||
run(() => {
|
||||
$effect(() => {
|
||||
if (dialog_element) {
|
||||
if (open) {
|
||||
dialog_element.showModal();
|
||||
@@ -110,30 +116,49 @@
|
||||
"
|
||||
>
|
||||
<!-- Modal Header -->
|
||||
{#if title || $$slots.header}
|
||||
<header class="p-4 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center">
|
||||
{#if $$slots.header}
|
||||
<slot name="header" />
|
||||
{#if title || header}
|
||||
<header
|
||||
class="flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700"
|
||||
>
|
||||
{#if header}
|
||||
{@render header()}
|
||||
{:else}
|
||||
<h3 class="text-xl font-semibold">{title}</h3>
|
||||
{/if}
|
||||
<button onclick={() => (open = false)} class="p-1 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
<button
|
||||
onclick={() => (open = false)}
|
||||
class="rounded-full p-1 hover:bg-gray-200 dark:hover:bg-gray-700"
|
||||
title="Close modal"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-6 w-6"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M6 18L18 6M6 6l12 12"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</header>
|
||||
{/if}
|
||||
|
||||
<!-- Modal Body -->
|
||||
<main class="p-4 overflow-y-auto max-h-[70vh]">
|
||||
<slot />
|
||||
<main class="max-h-[70vh] overflow-y-auto p-4">
|
||||
{#if children}
|
||||
{@render children()}
|
||||
{/if}
|
||||
</main>
|
||||
|
||||
<!-- Modal Footer -->
|
||||
{#if $$slots.footer}
|
||||
<footer class="p-4 border-t border-gray-200 dark:border-gray-700">
|
||||
<slot name="footer" />
|
||||
{#if footer}
|
||||
<footer class="border-t border-gray-200 p-4 dark:border-gray-700">
|
||||
{@render footer()}
|
||||
</footer>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user