Skip to content

Commit

Permalink
Plumb ID to editFeatureForm
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Jul 2, 2024
1 parent 42a52a7 commit 8437498
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export let cfg = {

editFeatureForm: null as null | ComponentType<
SvelteComponent<{
id: number;
props: { [name: string]: any };
}>
>,
Expand Down
6 changes: 5 additions & 1 deletion src/lib/sidebar/EditForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,8 @@

<ErrorMessage errorMessage={cfg.interventionWarning(feature)} />

<svelte:component this={cfg.editFeatureForm} bind:props={feature.properties} />
<svelte:component
this={cfg.editFeatureForm}
{id}
bind:props={feature.properties}
/>
4 changes: 4 additions & 0 deletions src/routes/ExampleFeatureForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
import { TextInput, Radio, Select, TextArea } from "govuk-svelte";
import { cfg } from "$lib/config";
export let id: number;
// TODO Can we make this generic?
export let props: any;
// Hide svelte-check warning
let _ = id;
</script>

<TextInput label="Name" bind:value={props.name} />
Expand Down

0 comments on commit 8437498

Please sign in to comment.