Skip to content

Commit

Permalink
Move xlsx import warnings to a modal
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Aug 8, 2024
1 parent 0242f43 commit 635cc0b
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/lib/files/ImportXlsx.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" generics="StateType">
import { stripSuffix, Loading } from "$lib";
import { FormElement, WarningText } from "govuk-svelte";
import { stripSuffix, Loading, Modal } from "$lib";
import { FormElement, SecondaryButton, WarningText } from "govuk-svelte";
import { createEventDispatcher } from "svelte";
let dispatch = createEventDispatcher<{
Expand All @@ -10,6 +10,7 @@
export let xlsxImporter: (buffer: ArrayBuffer) => Promise<StateType>;
let loading = "";
let open = false;
let fileInput: HTMLInputElement;
async function fileLoaded(e: Event) {
Expand All @@ -28,14 +29,22 @@
}
</script>

<FormElement label="Import from XLSX file" id="import-xlsx">
<input
bind:this={fileInput}
on:change={fileLoaded}
class="govuk-file-upload"
id="import-xlsx"
type="file"
/>
<SecondaryButton on:click={() => (open = true)}>
Import from XLSX file
</SecondaryButton>

<Loading {loading} />

<Modal title="Import from XLSX file" bind:open>
<FormElement label="Import from XLSX file" id="import-xlsx">
<input
bind:this={fileInput}
on:change={fileLoaded}
class="govuk-file-upload"
id="import-xlsx"
type="file"
/>
</FormElement>

<WarningText>
<p>
Expand All @@ -52,6 +61,5 @@
<li>Some text fields on the Summary of Scheme page will be missing</li>
</ul>
</WarningText>
</FormElement>

<Loading {loading} />
<SecondaryButton on:click={() => (open = false)}>Close</SecondaryButton>
</Modal>

0 comments on commit 635cc0b

Please sign in to comment.