2021-07-16 19:40:56 +00:00
|
|
|
import { Component, linkEvent } from "inferno";
|
2021-07-17 20:42:55 +00:00
|
|
|
import { i18n } from "../../i18next";
|
2021-07-16 19:40:56 +00:00
|
|
|
|
|
|
|
interface PaginatorProps {
|
2023-05-15 19:53:29 +00:00
|
|
|
page: number;
|
|
|
|
onChange(val: number): any;
|
2021-07-16 19:40:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export class Paginator extends Component<PaginatorProps, any> {
|
|
|
|
constructor(props: any, context: any) {
|
|
|
|
super(props, context);
|
|
|
|
}
|
|
|
|
render() {
|
|
|
|
return (
|
2022-09-22 15:03:35 +00:00
|
|
|
<div className="my-2">
|
2021-07-16 19:40:56 +00:00
|
|
|
<button
|
2022-09-22 15:03:35 +00:00
|
|
|
className="btn btn-secondary mr-2"
|
2023-05-15 19:53:29 +00:00
|
|
|
disabled={this.props.page == 1}
|
2021-07-16 19:40:56 +00:00
|
|
|
onClick={linkEvent(this, this.handlePrev)}
|
|
|
|
>
|
|
|
|
{i18n.t("prev")}
|
|
|
|
</button>
|
|
|
|
<button
|
2022-09-22 15:03:35 +00:00
|
|
|
className="btn btn-secondary"
|
2021-07-16 19:40:56 +00:00
|
|
|
onClick={linkEvent(this, this.handleNext)}
|
|
|
|
>
|
|
|
|
{i18n.t("next")}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
handlePrev(i: Paginator) {
|
2023-05-15 19:53:29 +00:00
|
|
|
i.props.onChange(i.props.page - 1);
|
2021-07-16 19:40:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
handleNext(i: Paginator) {
|
2023-05-15 19:53:29 +00:00
|
|
|
i.props.onChange(i.props.page + 1);
|
2021-07-16 19:40:56 +00:00
|
|
|
}
|
|
|
|
}
|