diff --git a/src/components/DataPage/DataPage.story.svelte b/src/components/DataPage/DataPage.story.svelte index 02b1d40e..7fd77b3f 100644 --- a/src/components/DataPage/DataPage.story.svelte +++ b/src/components/DataPage/DataPage.story.svelte @@ -60,7 +60,6 @@ let searchQuery = ''; let selectedCheckboxValue: SelectedCheckboxValueType; let selectedComboboxValue: SelectedComboboxValueType; - let mounted: boolean; $: filteredData = selectedCheckboxValue === undefined || @@ -89,7 +88,6 @@ bind:searchQuery bind:selectedCheckboxValue bind:selectedComboboxValue - bind:mounted >

ประวัติการลงมติ

@@ -123,10 +121,5 @@ >{JSON.stringify(selectedCheckboxValue, null, 2)} -
- Is Component Mounted? -
{mounted?.toString() ?? ''}
-
diff --git a/src/components/DataPage/DataPage.svelte b/src/components/DataPage/DataPage.svelte index 9369d813..ab790cc9 100644 --- a/src/components/DataPage/DataPage.svelte +++ b/src/components/DataPage/DataPage.svelte @@ -87,7 +87,6 @@ export let selectedCheckboxValue: SelectedCheckboxValueType = Object.fromEntries( checkboxFilterList.map((group) => [group.key, group.choices.map((choice) => choice.value)]) ); - export let mounted = false; export let downloadSize: 'sm' | 'lg' | 'otherPossibleValue' = 'sm'; export let downloadLinks: Link[] = []; @@ -121,8 +120,8 @@ let comboboxInternal: Record = {}; let showFilter = true; let isMobile = false; + onMount(() => { - mounted = true; showFilter = window.matchMedia(`(min-width: 672px)`).matches; isMobile = !showFilter; }); @@ -183,12 +182,11 @@ @@ -196,20 +194,12 @@ {#if showFilter} {/if}
- {#if mounted} -
- - - {#if header.key === 'files'} - เอก
สาร
- {:else} - {header.value} - {/if} -
- - - -
-
- {#if filteredData.length === 0} -
- ไม่พบข้อมูลที่ค้นหา -
- {/if} -
-
- {#if !showFilter} -
- {:else} -
- +
+ + + {#if header.key === 'files'} + เอก
สาร
+ {:else} + {header.value} + {/if} +
+ + + +
+
+ {#if filteredData.length === 0} +
+ ไม่พบข้อมูลที่ค้นหา
-
- {/if} +
+
+ {#if !showFilter} +