Skip to content

Commit

Permalink
fix: remove all pre-mount skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
Th1nkK1D committed Jun 14, 2024
1 parent b027cb2 commit c90bfd5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 37 deletions.
4 changes: 1 addition & 3 deletions src/components/Assemblies/Members/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
$: ({ assembly } = data);
export let searchQuery = '';
export let mounted = false;
</script>

<Breadcrumb
Expand Down Expand Up @@ -61,11 +60,10 @@
</div>
</div>
<Search
class="md:hidden {!mounted ? '-mt-4' : ''}"
class="md:hidden"
searchClass="md:hidden mt-2"
placeholder="ค้นหาชื่อบุคคล"
light
bind:value={searchQuery}
skeleton={!mounted}
/>
</header>
10 changes: 2 additions & 8 deletions src/components/Assemblies/SeatChart.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,15 @@
);
};
let mounted = false;
onMount(() => {
mounted = true;
redraw();
window.addEventListener('resize', redraw);
return () => {
window.removeEventListener('resize', redraw);
};
});
$: if (mounted) {
parties;
lineAmounts;
redraw();
}
</script>

<div
Expand Down
31 changes: 5 additions & 26 deletions src/routes/assemblies/[id]/members/[groupby]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,8 @@
let memberListSectionRef: HTMLElement;
let isMobile = false;
let mounted = false;
let currentCategory = '';
onMount(() => {
mounted = true;
showFilter = window.matchMedia(`(min-width: 672px)`).matches;
isMobile = !showFilter;
if (showFilter) {
Expand Down Expand Up @@ -103,21 +100,15 @@
});
</script>

<Header {data} bind:searchQuery {mounted} {availableAssemblies} />
<Header {data} bind:searchQuery {availableAssemblies} />
<Tab {data} />
<div class="relative flex">
{#if showFilter}
<aside
class="member-aside fixed bottom-0 left-0 right-0 top-0 z-40 flex flex-col gap-4 bg-white px-6 md:sticky md:top-[80px] md:z-0 md:h-[calc(100dvh-80px)] md:w-[250px] md:flex-none"
>
<div class="-mr-6 flex md:mr-0">
<Search
class="flex-1 {!mounted ? '-mt-6' : ''}"
placeholder="ค้นหาชื่อบุคคล"
light
bind:value={searchQuery}
skeleton={!mounted}
/>
<Search class="flex-1" placeholder="ค้นหาชื่อบุคคล" light bind:value={searchQuery} />
<div class="flex md:hidden">
<Button
kind="ghost"
Expand All @@ -128,31 +119,20 @@
on:click={() => {
showFilter = false;
}}
skeleton={!mounted}
/>
</div>
</div>
{#if currentPath === GroupByOption.Party}
<FormGroup legendText="ประเภท" noMargin>
<div class="flex items-center justify-between overflow-hidden">
<Checkbox
labelText="แบ่งเขต"
class="!m-0"
bind:checked={isByDistrict}
skeleton={!mounted}
/>
<Checkbox
labelText="บัญชีรายชื่อ"
class="!m-0"
bind:checked={isByPartylist}
skeleton={!mounted}
/>
<Checkbox labelText="แบ่งเขต" class="!m-0" bind:checked={isByDistrict} />
<Checkbox labelText="บัญชีรายชื่อ" class="!m-0" bind:checked={isByPartylist} />
</div>
</FormGroup>
{/if}
<div class="overflow-y-auto">
{#if isDataHasSubgroup}
<Accordion class="accordion-content-full" skeleton={!mounted}>
<Accordion class="accordion-content-full">
{#each filteredGroup as group (group.name)}
{#if 'subgroups' in group}
<AccordionItem open={currentPath === GroupByOption.Party}>
Expand Down Expand Up @@ -299,7 +279,6 @@
on:click={() => {
showFilter = true;
}}
skeleton={!mounted}
/>
{/if}
</div>
Expand Down

0 comments on commit c90bfd5

Please sign in to comment.