Skip to content

Commit

Permalink
QOL and remove skeletons for pagination component
Browse files Browse the repository at this point in the history
  • Loading branch information
WhyAsh5114 committed May 1, 2024
1 parent 5362578 commit 7006c38
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 28 deletions.
4 changes: 0 additions & 4 deletions src/app.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ body {
@apply h-[22px] w-16 rounded-full;
}

.pagination-skeleton {
@apply h-10 w-full;
}

.muted-text-box {
@apply rounded-md border p-2 text-muted-foreground;
}
4 changes: 2 additions & 2 deletions src/lib/components/Pagination.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
$: pageNumber = $page.url.searchParams.get('pageNumber')
? parseInt($page.url.searchParams.get('pageNumber') as string)
: undefined;
$countStore = count ?? $countStore;
: 1;
$: $countStore = count ?? $countStore;
</script>

<Pagination.Root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
</div>
{/each}
</div>
<Skeleton class="pagination-skeleton" />
17 changes: 6 additions & 11 deletions src/routes/mesocycles/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import { Separator } from '$lib/components/ui/separator';
import H2 from '$lib/components/ui/typography/H2.svelte';
import Button from '$lib/components/ui/button/button.svelte';
import MesocyclesPagination from './(components)/MesocyclesPagination.svelte';
import AddIcon from 'virtual:icons/lucide/plus';
import SearchIcon from 'virtual:icons/lucide/search';
Expand Down Expand Up @@ -108,14 +107,10 @@
{/if}
</div>

{#if mesocycles === 'loading'}
<Skeleton class="pagination-skeleton" />
{:else if mesocycles !== 'error'}
<Pagination
count={mesocyclesCount}
countStore={mesocyclesCountStore}
itemsPerPage={MESOCYCLES_PER_PAGE}
{updateParams}
/>
{/if}
<Pagination
count={mesocyclesCount}
countStore={mesocyclesCountStore}
itemsPerPage={MESOCYCLES_PER_PAGE}
{updateParams}
/>
</div>
17 changes: 7 additions & 10 deletions src/routes/workouts/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,11 @@
{/if}
</div>

{#if workouts === 'loading'}
<Skeleton class="pagination-skeleton" />
{:else}
<Pagination
count={workoutsCount}
countStore={workoutsCountStore}
itemsPerPage={WORKOUTS_PER_PAGE}
{updateParams}
/>
{/if}
<Pagination
count={workoutsCount}
countStore={workoutsCountStore}
itemsPerPage={WORKOUTS_PER_PAGE}
{updateParams}
/>
</div>

0 comments on commit 7006c38

Please sign in to comment.