30 lines
717 B
Plaintext
30 lines
717 B
Plaintext
package templates
|
|
|
|
import "fmt"
|
|
|
|
templ Pagination(currentPage, totalPages int) {
|
|
<div class="pagination">
|
|
if currentPage > 1 {
|
|
<a href={ templ.URL(fmt.Sprintf("/?page=%d", currentPage-1)) }
|
|
hx-get={ fmt.Sprintf("/?page=%d", currentPage-1) }
|
|
hx-target="#post-list"
|
|
hx-swap="outerHTML">
|
|
<- Previous
|
|
</a>
|
|
}
|
|
|
|
<span class="page-info">
|
|
Page { fmt.Sprintf("%d", currentPage) }
|
|
</span>
|
|
|
|
if currentPage < totalPages {
|
|
<a href={ templ.URL(fmt.Sprintf("/?page=%d", currentPage+1)) }
|
|
hx-get={ fmt.Sprintf("/?page=%d", currentPage+1) }
|
|
hx-target="#post-list"
|
|
hx-swap="outerHTML">
|
|
Next ->
|
|
</a>
|
|
}
|
|
</div>
|
|
}
|