mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-29 07:41:13 +00:00
Addressing PR comments.
This commit is contained in:
parent
fc41123c99
commit
9f9a2b66b8
1 changed files with 14 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue