mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
Refactored the comments ui into various new components, added the delete beer comment by id feature.
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { BeerPostQueryResult } from '@/services/BeerPost/schema/BeerPostQueryResult';
|
|
import { FC } from 'react';
|
|
import Link from 'next/link';
|
|
|
|
interface BeerCommentsPaginationBarProps {
|
|
commentsPageNum: number;
|
|
commentsPageCount: number;
|
|
beerPost: BeerPostQueryResult;
|
|
}
|
|
|
|
const BeerCommentsPaginationBar: FC<BeerCommentsPaginationBarProps> = ({
|
|
commentsPageNum,
|
|
commentsPageCount,
|
|
beerPost,
|
|
}) => (
|
|
<div className="flex items-center justify-center" id="comments-pagination">
|
|
<div className="btn-group grid w-6/12 grid-cols-2">
|
|
<Link
|
|
className={`btn-outline btn ${
|
|
commentsPageNum === 1
|
|
? 'btn-disabled pointer-events-none'
|
|
: 'pointer-events-auto'
|
|
}`}
|
|
href={{
|
|
pathname: `/beers/${beerPost.id}`,
|
|
query: { comments_page: commentsPageNum - 1 },
|
|
}}
|
|
scroll={false}
|
|
>
|
|
Next Comments
|
|
</Link>
|
|
<Link
|
|
className={`btn-outline btn ${
|
|
commentsPageNum === commentsPageCount
|
|
? 'btn-disabled pointer-events-none'
|
|
: 'pointer-events-auto'
|
|
}`}
|
|
href={{
|
|
pathname: `/beers/${beerPost.id}`,
|
|
query: { comments_page: commentsPageNum + 1 },
|
|
}}
|
|
scroll={false}
|
|
>
|
|
Previous Comments
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
);
|
|
|
|
export default BeerCommentsPaginationBar;
|