Loading karaokatalog/ui/static/components/pieces/Pagination.js 0 → 100644 +16 −0 Original line number Diff line number Diff line import PaginationControls from "./PaginationControls.js" const ELEMENTS_PER_PAGE = 25 export default { view(vnode) { const elements = vnode.attrs.elements.toArray() const totalPages = Math.ceil(elements.length / ELEMENTS_PER_PAGE) const startIndex = (this.currentPageIndex || 0) * ELEMENTS_PER_PAGE return [ elements.slice(startIndex, startIndex + ELEMENTS_PER_PAGE), m(PaginationControls, { currentPage: (this.currentPageIndex || 0) + 1, totalPages, onPageChange: i => this.currentPageIndex = i - 1 }) ] } } Loading
karaokatalog/ui/static/components/pieces/Pagination.js 0 → 100644 +16 −0 Original line number Diff line number Diff line import PaginationControls from "./PaginationControls.js" const ELEMENTS_PER_PAGE = 25 export default { view(vnode) { const elements = vnode.attrs.elements.toArray() const totalPages = Math.ceil(elements.length / ELEMENTS_PER_PAGE) const startIndex = (this.currentPageIndex || 0) * ELEMENTS_PER_PAGE return [ elements.slice(startIndex, startIndex + ELEMENTS_PER_PAGE), m(PaginationControls, { currentPage: (this.currentPageIndex || 0) + 1, totalPages, onPageChange: i => this.currentPageIndex = i - 1 }) ] } }