PHP Classes

File: src/components/pagination/index.tsx

Recommend this page to a friend!
  Classes of Maniruzzaman Akash   Maniruzzaman WordPress Frontend Editor   src/components/pagination/index.tsx   Download  
File: src/components/pagination/index.tsx
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Maniruzzaman WordPress Frontend Editor
WordPress plugin for visual front-end development
Author: By
Last change:
Date: 8 months ago
Size: 2,176 bytes
 

Contents

Class file image Download
/** * External dependencies. */ import {__} from "@wordpress/i18n"; /** * Internal dependencies. */ import {IPagination} from "../../interfaces"; export default function Pagination({ totalItems, perPage = 10, pageItems, currentPage = 1, onChangePage = () => {}, buttonStyle = {}, secondaryButtonStyle = {}, previousTextLabel = __('Previous', 'bsf-spacex'), nextTextLabel = __('Next', 'bsf-spacex'), }: IPagination) { const totalPages = Math.ceil(totalItems / perPage); return ( <div className='bsf-spacex-pagination'> <div className='total-items'> { pageItems > 0 && <div> <b className="page-count"> {__('Page', 'bsf-spacex')} - {currentPage} of {totalPages} &nbsp; </b> <span className="items-count"> {__('Showing', 'bsf-spacex')} {pageItems} in {totalItems} {__('items', 'bsf-spacex')} </span> </div> } </div> { totalPages > 1 && <div className='pagination-prev-next'> <button disabled={currentPage === 1} className="pagination-prev" style={secondaryButtonStyle} onClick={() => onChangePage(currentPage - 1)}> {previousTextLabel} </button> <button disabled={currentPage === totalPages} className="pagination-next" style={buttonStyle} onClick={() => onChangePage(currentPage + 1)}> {nextTextLabel} </button> </div> } </div> ) }