mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-28 12:43:12 +08:00
fix: update swizzled DocPaginator component
This commit is contained in:
@ -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>
|
||||||
« {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} »
|
|
||||||
</div>
|
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
12
website/src/theme/PaginatorNavLink/index.js
Normal file
12
website/src/theme/PaginatorNavLink/index.js
Normal file
@ -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;
|
Reference in New Issue
Block a user