wix-style-react
Version:
wix-style-react
31 lines (27 loc) • 897 B
JavaScript
import React from 'react';
import classNames from 'classnames';
import styles from './Pagination.scss';
import PropTypes from 'prop-types';
var Pagination = function Pagination(props) {
return React.createElement(
'div',
{ className: classNames(props.className, styles.pagination) },
props.totalPages && Array.from({ length: props.totalPages }, function (_, currentIndex) {
return React.createElement('div', {
key: currentIndex,
className: styles.dot,
'data-active': currentIndex === props.currentPage
});
})
);
};
//update images on imageUpdate
Pagination.propTypes = {
className: PropTypes.string,
/** The amount of pages to show */
totalPages: PropTypes.number.isRequired,
/** The active page index (zero based) */
currentPage: PropTypes.number.isRequired
};
Pagination.displayName = 'Pagination';
export default Pagination;