mirror of
https://codeberg.org/readeck/readeck.git
synced 2026-05-19 11:00:36 +00:00
150596399f
- Updated makefile so "make serve" watches for .templ files and
rebuild files upon changes
- Added a "templ" make target
- Added a top level "components" module
- Added a "components/forms" module
- Added server.RenderComponent method
- Added server.RenderTurboStreamComponent
- Preferences lazy loading
We're now ready to roll!
56 lines
1.4 KiB
Plaintext
56 lines
1.4 KiB
Plaintext
// SPDX-FileCopyrightText: © 2026 Olivier Meunier <olivier@neokraft.net>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
package components
|
|
|
|
import "codeberg.org/readeck/readeck/internal/server"
|
|
|
|
templ Pagination(p *server.Pagination) {
|
|
if p.TotalPages > 1 {
|
|
<nav class="paginator print:hidden">
|
|
<div class="paginator--basic">
|
|
if p.PreviousPage != "" {
|
|
<a href={ URL(ctx, p.PreviousPage) }>
|
|
{ L(ctx).Pgettext("page","Previous") }
|
|
</a>
|
|
} else {
|
|
<span></span>
|
|
}
|
|
if p.NextPage != "" {
|
|
<a href={ URL(ctx, p.NextPage) }>
|
|
{ L(ctx).Pgettext("page","Next") }
|
|
</a>
|
|
}
|
|
</div>
|
|
<div class="paginator--extended">
|
|
if p.PreviousPage != "" {
|
|
<a href={ URL(ctx, p.PreviousPage) } aria-label={ L(ctx).Gettext("Go to previous page") }>
|
|
@Icon("o-chevron-l")
|
|
</a>
|
|
}
|
|
for _, page := range p.PageLinks {
|
|
switch {
|
|
case page.Index == p.CurrentPage:
|
|
<span class="paginator--current">{ page.Index }</span>
|
|
case page.Index != 0:
|
|
<a
|
|
href={ URL(ctx, page.URL) }
|
|
aria-label={ L(ctx).Gettext("Go to page %d", page.Index) }
|
|
>
|
|
{ page.Index }
|
|
</a>
|
|
default:
|
|
<span class="paginator--hellip">…</span>
|
|
}
|
|
}
|
|
if p.NextPage != "" {
|
|
<a href={ URL(ctx, p.NextPage) } aria-label={ L(ctx).Gettext("Go to next page") }>
|
|
@Icon("o-chevron-r")
|
|
</a>
|
|
}
|
|
</div>
|
|
</nav>
|
|
}
|
|
}
|