fix: update swizzled DocPaginator component

pull/258/head
Yangshun 3 years ago
parent 82900a9411
commit 2f7cb41c9d

@ -8,8 +8,7 @@ import React from 'react';
import Translate, {translate} from '@docusaurus/Translate'; import Translate, {translate} from '@docusaurus/Translate';
import SidebarAd from '../../components/SidebarAd'; import SidebarAd from '../../components/SidebarAd';
function DocPaginator(props) { function DocPaginator({previous, next}) {
const {metadata} = props;
return ( return (
<> <>
<nav <nav
@ -20,10 +19,8 @@ function DocPaginator(props) {
description: 'The ARIA label for the docs pagination', description: 'The ARIA label for the docs pagination',
})}> })}>
<div className="pagination-nav__item"> <div className="pagination-nav__item">
{metadata.previous && ( {previous && (
<a <a className="pagination-nav__link" href={previous.permalink}>
className="pagination-nav__link"
href={metadata.previous.permalink}>
<div className="pagination-nav__sublabel"> <div className="pagination-nav__sublabel">
<Translate <Translate
id="theme.docs.paginator.previous" id="theme.docs.paginator.previous"
@ -31,15 +28,13 @@ function DocPaginator(props) {
Previous Previous
</Translate> </Translate>
</div> </div>
<div className="pagination-nav__label"> <div className="pagination-nav__label">{previous.title}</div>
&laquo; {metadata.previous.title}
</div>
</a> </a>
)} )}
</div> </div>
<div className="pagination-nav__item pagination-nav__item--next"> <div className="pagination-nav__item pagination-nav__item--next">
{metadata.next && ( {next && (
<a className="pagination-nav__link" href={metadata.next.permalink}> <a className="pagination-nav__link" href={next.permalink}>
<div className="pagination-nav__sublabel"> <div className="pagination-nav__sublabel">
<Translate <Translate
id="theme.docs.paginator.next" id="theme.docs.paginator.next"
@ -47,9 +42,7 @@ function DocPaginator(props) {
Next Next
</Translate> </Translate>
</div> </div>
<div className="pagination-nav__label"> <div className="pagination-nav__label">{next.title}</div>
{metadata.next.title} &raquo;
</div>
</a> </a>
)} )}
</div> </div>

@ -0,0 +1,12 @@
import React from 'react';
function PaginatorNavLink({permalink, title, subLabel}) {
return (
<a className="pagination-nav__link" href={permalink}>
{subLabel && <div className="pagination-nav__sublabel">{subLabel}</div>}
<div className="pagination-nav__label">{title}</div>
</a>
);
}
export default PaginatorNavLink;
Loading…
Cancel
Save