mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-09-10 10:16:21 +02:00
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { PAGINATION } from "@/constants";
|
|
import classNames from "classnames";
|
|
import { Link } from "gatsby";
|
|
import React from "react";
|
|
import * as styles from "./Pagination.module.scss";
|
|
|
|
type Props = {
|
|
prevPagePath: string;
|
|
nextPagePath: string;
|
|
hasNextPage: boolean;
|
|
hasPrevPage: boolean;
|
|
};
|
|
|
|
const Pagination = ({ prevPagePath, nextPagePath, hasNextPage, hasPrevPage }: Props) => {
|
|
const prevClassName = classNames(styles.previousLink, {
|
|
[styles.disable]: !hasPrevPage,
|
|
});
|
|
|
|
const nextClassName = classNames(styles.nextLink, {
|
|
[styles.disable]: !hasNextPage,
|
|
});
|
|
|
|
return (
|
|
<div className={`${styles.pagination}`}>
|
|
<div className={styles.previous}>
|
|
<Link
|
|
rel="prev"
|
|
to={hasPrevPage ? prevPagePath : "/"}
|
|
className={`${prevClassName} hideInPrintView`}
|
|
>
|
|
{PAGINATION.PREV_PAGE}
|
|
</Link>
|
|
</div>
|
|
<div className={styles.next}>
|
|
<Link
|
|
rel="next"
|
|
to={hasNextPage ? nextPagePath : "/"}
|
|
className={`${nextClassName} hideInPrintView`}
|
|
>
|
|
{PAGINATION.NEXT_PAGE}
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Pagination;
|