mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
* init react-bootstrap-table2-paginator * add react-bootstrap-table2-paginator as dependency * no container * handle for wrapping pagination component * add style for paginator addon * add story for pagination * implement pagination list * constants maintain in core package * implement sizePerPage dropdown * fix unalign for sizePerPage dropdown and pagination list * allow to return array from render(react@16 new feature) * implement pagination hooks * add story for pagination hooks * fixed dependencies version and upgrade enzyme * Shallow renderer no longer calls componentDidMount because DOM refs are not available * classNames -> className for TextEditor * add tests for pagination * fix react-bootstrap-table can't be resolved in other modules * implement custom page button title * add test for page button title * fix bug when sizePerPageList is an object array * add story for custom pagination * remove necessary component extends * move pagination options to react-bootstrap-table2-paginator * refine pagination stories * implement hideSizePerPage * implement hidePageListOnlyOnePage * fix multiple same key warning * remove help * support start from react@^16
48 lines
1.0 KiB
JavaScript
48 lines
1.0 KiB
JavaScript
/* eslint react/require-default-props: 0 */
|
|
/* eslint jsx-a11y/href-no-hash: 0 */
|
|
import cs from 'classnames';
|
|
import React, { Component } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
class PageButton extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.handleClick = this.handleClick.bind(this);
|
|
}
|
|
|
|
handleClick(e) {
|
|
e.preventDefault();
|
|
this.props.onPageChange(this.props.page);
|
|
}
|
|
|
|
render() {
|
|
const {
|
|
page,
|
|
title,
|
|
active,
|
|
disabled
|
|
} = this.props;
|
|
const classes = cs({
|
|
active,
|
|
disabled,
|
|
'page-item': true
|
|
});
|
|
|
|
return (
|
|
<li className={ classes } title={ title }>
|
|
<a href="#" onClick={ this.handleClick } className="page-link">{ page }</a>
|
|
</li>
|
|
);
|
|
}
|
|
}
|
|
|
|
PageButton.propTypes = {
|
|
onPageChange: PropTypes.func.isRequired,
|
|
page: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
active: PropTypes.bool.isRequired,
|
|
disabled: PropTypes.bool.isRequired,
|
|
title: PropTypes.string
|
|
};
|
|
|
|
export default PageButton;
|