article grid missing home page fix

This commit is contained in:
tmshv committed 2020-02-22 03:28:04 +03:00
1 parent 2fa0083fd1
commit 11d628fd50
1 file changed
+11 -3
+11 -3
View File
@@ -12,7 +12,14 @@ export type ArticleGridProps = {
prevPage: number | null 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 <CardGrid
style={{ style={{
@@ -60,8 +67,9 @@ export const ArticleGrid: React.FC<ArticleGridProps> = ({ articles, nextPage, pr
</CardGrid> </CardGrid>
<Pager <Pager
nextHref={nextPage ? `/articles/${nextPage}` : null} nextHref={nextHref}
prevHref={prevPage ? `/articles/${prevPage}` : null} prevHref={prevHref}
/> />
</> </>
) )
}