initial commit - added base, need to fix templ errors
This commit is contained in:
29
templates/pagination.templ
Normal file
29
templates/pagination.templ
Normal file
@@ -0,0 +1,29 @@
|
||||
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>
|
||||
}
|
Reference in New Issue
Block a user