Addressing PR comments.

This commit is contained in:
Dessalines 2023-10-06 08:52:38 -04:00
parent fc41123c99
commit 9f9a2b66b8

View file

@ -5,8 +5,18 @@ import { PaginationCursor } from "lemmy-js-client";
interface PaginatorCursorProps {
prevPage?: PaginationCursor;
nextPage?: PaginationCursor;
onNext(val: PaginationCursor): any;
onPrev(): any;
onNext(val: PaginationCursor): void;
onPrev(): void;
}
function handlePrev(i: PaginatorCursor) {
i.props.onPrev();
}
function handleNext(i: PaginatorCursor) {
if (i.props.nextPage) {
i.props.onNext(i.props.nextPage);
}
}
export class PaginatorCursor extends Component<PaginatorCursorProps, any> {
@ -19,13 +29,13 @@ export class PaginatorCursor extends Component<PaginatorCursorProps, any> {
<button
className="btn btn-secondary me-2"
disabled={!this.props.prevPage}
onClick={linkEvent(this, this.handlePrev)}
onClick={linkEvent(this, handlePrev)}
>
{I18NextService.i18n.t("prev")}
</button>
<button
className="btn btn-secondary"
onClick={linkEvent(this, this.handleNext)}
onClick={linkEvent(this, handleNext)}
disabled={!this.props.nextPage}
>
{I18NextService.i18n.t("next")}
@ -33,14 +43,4 @@ export class PaginatorCursor extends Component<PaginatorCursorProps, any> {
</div>
);
}
handlePrev(i: PaginatorCursor) {
i.props.onPrev();
}
handleNext(i: PaginatorCursor) {
if (i.props.nextPage) {
i.props.onNext(i.props.nextPage);
}
}
}