2021-07-16 19:40:56 +00:00
|
|
|
import { Component, linkEvent } from "inferno";
|
2023-06-22 00:54:35 +00:00
|
|
|
import { I18NextService } from "../../services";
|
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 (
|
2023-06-20 18:46:16 +00:00
|
|
|
<div className="paginator my-2">
|
2021-07-16 19:40:56 +00:00
|
|
|
<button
|
2023-06-20 12:01:29 +00:00
|
|
|
className="btn btn-secondary me-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)}
|
|
|
|
>
|
2023-06-22 00:54:35 +00:00
|
|
|
{I18NextService.i18n.t("prev")}
|
2021-07-16 19:40:56 +00:00
|
|
|
</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)}
|
|
|
|
>
|
2023-06-22 00:54:35 +00:00
|
|
|
{I18NextService.i18n.t("next")}
|
2021-07-16 19:40:56 +00:00
|
|
|
</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
|
|
|
}
|
|
|
|
}
|