mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-26 06:11:15 +00:00
Remove previous button for PaginatorCursor (#2221)
This commit is contained in:
parent
ad300f19d0
commit
795dcdb894
4 changed files with 16 additions and 34 deletions
|
@ -3,14 +3,8 @@ import { I18NextService } from "../../services";
|
||||||
import { PaginationCursor } from "lemmy-js-client";
|
import { PaginationCursor } from "lemmy-js-client";
|
||||||
|
|
||||||
interface PaginatorCursorProps {
|
interface PaginatorCursorProps {
|
||||||
prevPage?: PaginationCursor;
|
|
||||||
nextPage?: PaginationCursor;
|
nextPage?: PaginationCursor;
|
||||||
onNext(val: PaginationCursor): void;
|
onNext(val: PaginationCursor): void;
|
||||||
onPrev(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
function handlePrev(i: PaginatorCursor) {
|
|
||||||
i.props.onPrev();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleNext(i: PaginatorCursor) {
|
function handleNext(i: PaginatorCursor) {
|
||||||
|
@ -26,13 +20,6 @@ export class PaginatorCursor extends Component<PaginatorCursorProps, any> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="paginator my-2">
|
<div className="paginator my-2">
|
||||||
<button
|
|
||||||
className="btn btn-secondary me-2"
|
|
||||||
disabled={!this.props.prevPage}
|
|
||||||
onClick={linkEvent(this, handlePrev)}
|
|
||||||
>
|
|
||||||
{I18NextService.i18n.t("prev")}
|
|
||||||
</button>
|
|
||||||
<button
|
<button
|
||||||
className="btn btn-secondary"
|
className="btn btn-secondary"
|
||||||
onClick={linkEvent(this, handleNext)}
|
onClick={linkEvent(this, handleNext)}
|
||||||
|
|
|
@ -14,20 +14,22 @@ export class Paginator extends Component<PaginatorProps, any> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="paginator my-2">
|
<div className="paginator my-2">
|
||||||
|
{this.props.page !== 1 && (
|
||||||
<button
|
<button
|
||||||
className="btn btn-secondary me-2"
|
className="btn btn-secondary me-2"
|
||||||
disabled={this.props.page === 1}
|
|
||||||
onClick={linkEvent(this, this.handlePrev)}
|
onClick={linkEvent(this, this.handlePrev)}
|
||||||
>
|
>
|
||||||
{I18NextService.i18n.t("prev")}
|
{I18NextService.i18n.t("prev")}
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
|
{!this.props.nextDisabled && (
|
||||||
<button
|
<button
|
||||||
className="btn btn-secondary"
|
className="btn btn-secondary"
|
||||||
onClick={linkEvent(this, this.handleNext)}
|
onClick={linkEvent(this, this.handleNext)}
|
||||||
disabled={this.props.nextDisabled || false}
|
|
||||||
>
|
>
|
||||||
{I18NextService.i18n.t("next")}
|
{I18NextService.i18n.t("next")}
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,6 @@ export class Community extends Component<
|
||||||
}
|
}
|
||||||
|
|
||||||
renderCommunity() {
|
renderCommunity() {
|
||||||
const { pageCursor } = getCommunityQueryParams();
|
|
||||||
switch (this.state.communityRes.state) {
|
switch (this.state.communityRes.state) {
|
||||||
case "loading":
|
case "loading":
|
||||||
return (
|
return (
|
||||||
|
@ -341,10 +340,8 @@ export class Community extends Component<
|
||||||
{this.selects(res)}
|
{this.selects(res)}
|
||||||
{this.listings(res)}
|
{this.listings(res)}
|
||||||
<PaginatorCursor
|
<PaginatorCursor
|
||||||
prevPage={pageCursor}
|
|
||||||
nextPage={this.getNextPage}
|
nextPage={this.getNextPage}
|
||||||
onNext={this.handlePageNext}
|
onNext={this.handlePageNext}
|
||||||
onPrev={this.handlePagePrev}
|
|
||||||
/>
|
/>
|
||||||
</main>
|
</main>
|
||||||
<aside className="d-none d-md-block col-md-4 col-lg-3">
|
<aside className="d-none d-md-block col-md-4 col-lg-3">
|
||||||
|
|
|
@ -635,18 +635,14 @@ export class Home extends Component<any, HomeState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
get posts() {
|
get posts() {
|
||||||
const { pageCursor } = getHomeQueryParams();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="main-content-wrapper">
|
<div className="main-content-wrapper">
|
||||||
<div>
|
<div>
|
||||||
{this.selects}
|
{this.selects}
|
||||||
{this.listings}
|
{this.listings}
|
||||||
<PaginatorCursor
|
<PaginatorCursor
|
||||||
prevPage={pageCursor}
|
|
||||||
nextPage={this.getNextPage}
|
nextPage={this.getNextPage}
|
||||||
onNext={this.handlePageNext}
|
onNext={this.handlePageNext}
|
||||||
onPrev={this.handlePagePrev}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue