Refactoring beer by id page, add delete comment

Refactored the comments ui into various new components, added the delete beer comment by id feature.
This commit is contained in:
Aaron William Po
2023-03-03 21:19:18 -05:00
parent 4a6e10572c
commit 472ead9abd
16 changed files with 331 additions and 136 deletions

View File

@@ -0,0 +1,50 @@
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;