article grid missing home page fix
This commit is contained in:
1 parent
2fa0083fd1
commit
11d628fd50
1 file changed
+11
-3
@@ -12,7 +12,14 @@ export type ArticleGridProps = {
|
||||
prevPage: number | null
|
||||
}
|
||||
|
||||
export const ArticleGrid: React.FC<ArticleGridProps> = ({ articles, nextPage, prevPage, ...props }) => (
|
||||
export const ArticleGrid: React.FC<ArticleGridProps> = ({ articles, nextPage, prevPage, ...props }) => {
|
||||
const nextHref = nextPage ? `/articles/${nextPage}` : null
|
||||
let prevHref = prevPage ? `/articles/${prevPage}` : null
|
||||
if (prevPage === 1) {
|
||||
prevHref = '/'
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<CardGrid
|
||||
style={{
|
||||
@@ -60,8 +67,9 @@ export const ArticleGrid: React.FC<ArticleGridProps> = ({ articles, nextPage, pr
|
||||
</CardGrid>
|
||||
|
||||
<Pager
|
||||
nextHref={nextPage ? `/articles/${nextPage}` : null}
|
||||
prevHref={prevPage ? `/articles/${prevPage}` : null}
|
||||
nextHref={nextHref}
|
||||
prevHref={prevHref}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user