/var/www/vhosts/ihelp.ro/ajutam.ro/wp-content/plugins/give/src/Views/Components/Pagination
NameSizeModeActions
index.js40770644editdlrm
Edit: /var/www/vhosts/ihelp.ro/ajutam.ro/wp-content/plugins/give/src/Views/Components/Pagination/index.js (4077B)
import PropTypes from 'prop-types'; const {__} = wp.i18n; const Pagination = ({currentPage, totalPages, disabled, setPage}) => { if (1 >= totalPages) { return false; } const nextPage = parseInt(currentPage) + 1; const previousPage = parseInt(currentPage) - 1; return (
{previousPage > 0 ? ( <> { e.preventDefault(); if (!disabled) { setPage(1); } }} > « {' '} { e.preventDefault(); if (!disabled) { setPage(parseInt(currentPage) - 1); } }} > ‹ ) : ( )} {__('Current Page', 'give')} {' '} {currentPage} {__('of', 'give')} {totalPages}{' '} {nextPage <= totalPages ? ( <> { e.preventDefault(); if (!disabled) { setPage(parseInt(currentPage) + 1); } }} > › {' '} { e.preventDefault(); if (!disabled) { setPage(totalPages); } }} > » ) : ( )}
); }; Pagination.propTypes = { // Current page currentPage: PropTypes.number.isRequired, // Total number of pages totalPages: PropTypes.number.isRequired, // Function to set the next/previous page setPage: PropTypes.func.isRequired, // Is pagination disabled disabled: PropTypes.bool.isRequired, }; Pagination.defaultProps = { currentPage: 1, totalPages: 0, setPage: () => {}, disabled: false, }; export default Pagination;