-
Notifications
You must be signed in to change notification settings - Fork 160
/
PostPageNav.jsx
38 lines (33 loc) · 962 Bytes
/
PostPageNav.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from 'react';
import Link from 'next/link';
import { useTranslation } from 'next-i18next';
const makeHref = (name) => ({
pathname: '/[name]',
query: {
name,
},
});
const PostPageNav = ({ nextPost, prevPost }) => {
const { t } = useTranslation('post');
const prevHref = makeHref(prevPost.name);
const nextHref = makeHref(nextPost.name);
return (
<div className="row PageNavigation mt-4 prevnextlinks d-flex justify-content-between">
<div className="col-md-6 rightborder pl-0">
<Link href={prevHref}>
<a alt={t('page.prev_guide')} className="thepostlink">
« {prevPost.header}
</a>
</Link>
</div>
<div className="col-md-6 text-end pr-0">
<Link href={nextHref}>
<a alt={t('page.next_guide')} className="thepostlink">
{nextPost.header} »
</a>
</Link>
</div>
</div>
);
};
export default PostPageNav;