Skip to content

Commit e67e741

Browse files
use console version of the Modal
1 parent 20fd52a commit e67e741

File tree

1 file changed

+31
-46
lines changed

1 file changed

+31
-46
lines changed

src/lib/components/confirm.svelte

Lines changed: 31 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<script lang="ts">
2-
import { Button, Form, InputCheckbox } from '$lib/elements/forms';
3-
import { Alert, Layout, Modal } from '@appwrite.io/pink-svelte';
4-
2+
import { Button, InputCheckbox } from '$lib/elements/forms';
3+
import { Layout } from '@appwrite.io/pink-svelte';
4+
import { Modal } from '.';
55
export let open: boolean;
66
export let title: string;
77
export let error: string = null;
88
export let action: string = 'Delete';
9-
export let canDelete: boolean = true;
109
export let disabled: boolean = false;
1110
export let submissionLoader = false;
1211
export let confirmDeletion: boolean = false;
@@ -23,48 +22,34 @@
2322
}
2423
</script>
2524

26-
<Form isModal {onSubmit}>
27-
<Modal bind:open {title} size="s">
28-
<Layout.Stack gap="xl">
29-
{#if error}
30-
<Alert.Inline
31-
dismissible
32-
status="error"
33-
on:dismiss={() => {
34-
error = null;
35-
}}>
36-
{error}
37-
</Alert.Inline>
38-
{/if}
25+
<Modal size="s" bind:show={open} {title} {onSubmit} bind:error>
26+
<svelte:fragment slot="description">
27+
{#if confirmDeletion}
28+
This action is irreversible. Please confirm to proceed.
29+
{/if}
30+
</svelte:fragment>
3931

40-
<Layout.Stack gap="l">
41-
<slot />
32+
<Layout.Stack gap="l">
33+
<slot />
4234

43-
{#if confirmDeletion}
44-
<InputCheckbox
45-
size="s"
46-
required
47-
id={checkboxId}
48-
bind:checked={confirm}
49-
label="I understand and confirm" />
50-
{/if}
51-
</Layout.Stack>
52-
</Layout.Stack>
35+
{#if confirmDeletion}
36+
<InputCheckbox
37+
size="s"
38+
required
39+
id={checkboxId}
40+
bind:checked={confirm}
41+
label="I understand and confirm" />
42+
{/if}
43+
</Layout.Stack>
5344

54-
<svelte:fragment slot="footer">
55-
<Layout.Stack direction="row" gap="s" justifyContent="flex-end">
56-
<slot name="footer">
57-
<Button text on:click={() => (open = false)}>Cancel</Button>
58-
{#if canDelete}
59-
<Button
60-
danger
61-
submit
62-
{submissionLoader}
63-
disabled={disabled || (confirmDeletion ? !confirm : false)}
64-
>{action}</Button>
65-
{/if}
66-
</slot>
67-
</Layout.Stack>
68-
</svelte:fragment>
69-
</Modal>
70-
</Form>
45+
<svelte:fragment slot="footer">
46+
<Button text on:click={() => (open = false)}>Cancel</Button>
47+
<Button
48+
danger
49+
submit
50+
{submissionLoader}
51+
disabled={disabled || (confirmDeletion ? !confirm : false)}>
52+
{action}
53+
</Button>
54+
</svelte:fragment>
55+
</Modal>

0 commit comments

Comments
 (0)