Skip to content

Commit cfac19c

Browse files
committed
fix examples
1 parent 8f4d6e0 commit cfac19c

2 files changed

Lines changed: 10 additions & 13 deletions

File tree

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ It also supports conditionally loading any external scripts for analytics, perfo
133133
import Dialog from 'syv/core/Dialog.svelte';
134134
135135
import type { ComponentProps } from 'svelte';
136-
type Props = Omit<ComponentProps<typeof Dialog>, 'children'> & {
136+
interface Props extends Omit<ComponentProps<typeof Dialog>, 'children'> {
137137
// your own props
138138
}
139139
let props: Props = $props();
@@ -148,9 +148,8 @@ It also supports conditionally loading any external scripts for analytics, perfo
148148
'--padding': '1rem 1.5rem 1.5rem', // adjust padding as needed
149149
}}
150150
>
151-
{#snippet children({ forward })}
152-
<!-- structure your own dialog content here -->
153-
{/snippet}
151+
<!-- structure your own dialog content here -->
152+
<button onclick={props.onclose}>close</button>
154153
</Dialog>
155154
156155
<style>

src/routes/ExampleDialog.svelte

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
import Dialog from '$lib/core/Dialog.svelte';
33
import type { ComponentProps } from 'svelte';
44
5-
type Props = Omit<ComponentProps<typeof Dialog>, 'children'> & {
5+
interface Props extends Omit<ComponentProps<typeof Dialog>, 'children'> {
66
required: boolean;
7-
};
8-
let { required = false }: Props = $props();
7+
}
8+
let { required = false, ...props }: Props = $props();
99
</script>
1010

11-
<Dialog {required}>
12-
{#snippet children({ close })}
13-
<h2>Hello from Dialog</h2>
11+
<Dialog {required} {...props}>
12+
<h2>Hello from Dialog</h2>
1413

15-
<input type="text" />
14+
<input type="text" />
1615

17-
<button onclick={close}>Close Dialog</button>
18-
{/snippet}
16+
<button onclick={props.onclose}>Close Dialog</button>
1917
</Dialog>

0 commit comments

Comments
 (0)