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