Fix showcase Pagination
This commit is contained in:
parent
eea201cd12
commit
81f6be6a00
@ -107,7 +107,18 @@ function PaginationDemo() {
|
|||||||
const content = (
|
const content = (
|
||||||
<Pagination page={page()} totalPages={5} onPageChange={setPage} class="flex items-center gap-1">
|
<Pagination page={page()} totalPages={5} onPageChange={setPage} class="flex items-center gap-1">
|
||||||
<Pagination.Previous class="px-2 py-1 text-sm border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-40">Prev</Pagination.Previous>
|
<Pagination.Previous class="px-2 py-1 text-sm border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-40">Prev</Pagination.Previous>
|
||||||
<Pagination.Items class="px-2 py-1 text-sm rounded cursor-pointer hover:bg-indigo-50 data-[current]:bg-indigo-600 data-[current]:text-white" />
|
<Pagination.Items>
|
||||||
|
{(item) => (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class={`px-2 py-1 text-sm rounded ${item.isActive ? "bg-indigo-600 text-white" : "hover:bg-indigo-50 cursor-pointer"} ${item.type === "ellipsis" ? "cursor-default" : ""}`}
|
||||||
|
onClick={() => { if (item.page) setPage(item.page); }}
|
||||||
|
disabled={item.type === "ellipsis"}
|
||||||
|
>
|
||||||
|
{item.type === "ellipsis" ? "..." : item.page}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</Pagination.Items>
|
||||||
<Pagination.Next class="px-2 py-1 text-sm border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-40">Next</Pagination.Next>
|
<Pagination.Next class="px-2 py-1 text-sm border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-40">Next</Pagination.Next>
|
||||||
</Pagination>
|
</Pagination>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user