mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import Router from 'react-router';
|
|
|
|
let Link = Router.Link;
|
|
|
|
|
|
let Pagination = React.createClass({
|
|
|
|
goToPage(page) {
|
|
return () => this.props.fetchList(page, this.props.pageSize, this.props.search,
|
|
this.props.orderBy, this.props.orderAsc);
|
|
},
|
|
|
|
render() {
|
|
let prev = parseInt(this.props.page, 10) - 1;
|
|
let next = parseInt(this.props.page, 10) + 1;
|
|
|
|
return(
|
|
<nav>
|
|
<ul className="pager">
|
|
<li className="previous">
|
|
<Link to="pieces"
|
|
query={{page: prev}}
|
|
onClick={this.goToPage(prev)}>
|
|
<span aria-hidden="true">←</span>
|
|
Previous
|
|
</Link>
|
|
</li>
|
|
<li className="next">
|
|
<Link to="pieces"
|
|
query={{page: next}}
|
|
onClick={this.goToPage(next)}>
|
|
Next
|
|
<span aria-hidden="true">→</span>
|
|
</Link>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
);
|
|
}
|
|
});
|
|
|
|
export default Pagination;
|