feat: split tackle catalog pagination

This commit is contained in:
ik committed 2026-09-22 19:53:31 +07:00
1 parent a8288b2dd3
commit 089b9cc11d
5 files changed
+47 -20

No files matched your search

+4 -3
View File
@@ -7,21 +7,22 @@ interface Props {
total: number;
limit: number;
offset: number;
offsetParam?: string;
anchor?: string;
itemLabel?: string;
}
const { path, params, total, limit, offset, anchor = "", itemLabel = "записей" } = Astro.props;
const { path, params, total, limit, offset, offsetParam = "offset", anchor = "", itemLabel = "записей" } = Astro.props;
const state = pageWindow(total, limit, offset);
---
{total > limit && <nav class="pagination" aria-label="Пагинация">
<span>{state.start}–{state.end} из {total} {itemLabel} · страница {state.page} из {state.pages}</span>
<div>
{state.previousOffset !== null
? <a data-action="secondary" rel="prev" href={pageHref(path, params, state.previousOffset, anchor)}>← Предыдущая</a>
? <a data-action="secondary" rel="prev" href={pageHref(path, params, state.previousOffset, anchor, offsetParam)}>← Предыдущая</a>
: <span class="pagination__disabled" aria-disabled="true">← Предыдущая</span>}
{state.nextOffset !== null
? <a data-action="secondary" rel="next" href={pageHref(path, params, state.nextOffset, anchor)}>Следующая →</a>
? <a data-action="secondary" rel="next" href={pageHref(path, params, state.nextOffset, anchor, offsetParam)}>Следующая →</a>
: <span class="pagination__disabled" aria-disabled="true">Следующая →</span>}
</div>
</nav>}