Skip to content

Commit 0153806

Browse files
committed
New pagination dropdown for better contrast and styles
1 parent c9cbc99 commit 0153806

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

src/lib/components/Table/TablePagination.svelte

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
faAnglesRight,
55
faAngleRight,
66
faAnglesLeft,
7-
faAngleLeft
7+
faAngleLeft,
8+
faChevronDown
89
} from '@fortawesome/free-solid-svg-icons';
10+
import { ListBox, ListBoxItem, popup, type PopupSettings } from '@skeletonlabs/skeleton';
911
1012
export let pageConfig;
1113
export let pageSizes;
@@ -31,24 +33,50 @@
3133
}
3234
};
3335
36+
let pageSizeDropdownValue: string = $pageSize;
37+
38+
const pageSizePopup: PopupSettings = {
39+
event: 'click',
40+
target: `#${id}-pageSizeDropdown`,
41+
placement: 'bottom',
42+
closeQuery: '.listbox-item'
43+
};
44+
3445
$: goToFirstPageDisabled = !$pageIndex;
3546
$: goToLastPageDisabled = $pageIndex == $pageCount - 1;
3647
$: goToNextPageDisabled = !$hasNextPage;
3748
$: goToPreviousPageDisabled = !$hasPreviousPage;
49+
$: $pageSize = pageSizeDropdownValue;
3850
</script>
3951

40-
<div class="flex justify-between w-full items-stretch gap-10">
52+
<div class="flex justify-between w-full items-stretch gap-10 z-50">
4153
<div class="flex justify-start">
42-
<select
54+
<!-- <select
4355
name="pageSize"
4456
id="{id}-pageSize"
4557
class="select variant-filled-primary w-min font-bold"
4658
bind:value={$pageSize}
4759
>
4860
{#each pageSizes as size}
49-
<option value={size} class="!bg-primary-700">{size}</option>
61+
<option value={size} class="">{size}</option>
5062
{/each}
51-
</select>
63+
</select> -->
64+
65+
<button class="btn variant-filled-primary w-20 justify-between" use:popup={pageSizePopup}>
66+
<span class="capitalize font-semibold">{pageSizeDropdownValue}</span>
67+
<Fa icon={faChevronDown} size="xs" />
68+
</button>
69+
70+
<div class="card w-20 shadow-xl py-2" data-popup={`#${id}-pageSizeDropdown`}>
71+
<ListBox rounded="rounded-none">
72+
{#each pageSizes as size}
73+
<ListBoxItem bind:group={pageSizeDropdownValue} name="medium" value={size}
74+
>{size}</ListBoxItem
75+
>
76+
{/each}
77+
</ListBox>
78+
<div class="arrow bg-surface-100-800-token" />
79+
</div>
5280
</div>
5381
<div class="flex justify-center gap-1">
5482
<button

0 commit comments

Comments
 (0)