diff --git a/packages/docusaurus-theme-classic/src/theme-classic.d.ts b/packages/docusaurus-theme-classic/src/theme-classic.d.ts index fb781f4adb..c4d51f69ef 100644 --- a/packages/docusaurus-theme-classic/src/theme-classic.d.ts +++ b/packages/docusaurus-theme-classic/src/theme-classic.d.ts @@ -129,18 +129,6 @@ declare module '@theme/DocPaginator' { export default function DocPaginator(props: Props): JSX.Element; } -declare module '@theme/DocPaginatorNavLink' { - import type {PropNavigationLink} from '@docusaurus/plugin-content-docs'; - - // May be simpler to provide a {navigation: PropNavigation} prop? - export interface Props { - navLink: PropNavigationLink; - next?: boolean; - } - - export default function DocPaginatorNavLink(props: Props): JSX.Element; -} - declare module '@theme/DocSidebar' { import type {PropSidebarItem} from '@docusaurus/plugin-content-docs'; @@ -523,6 +511,18 @@ declare module '@theme/NavbarItem' { export default NavbarItem; } +declare module '@theme/PaginatorNavLink' { + import type {ReactNode} from 'react'; + import type {PropNavigationLink} from '@docusaurus/plugin-content-docs'; + + export interface Props extends Omit { + readonly title: ReactNode; + readonly subLabel?: JSX.Element; + } + + export default function PaginatorNavLink(props: Props): JSX.Element; +} + declare module '@theme/SearchBar' { export default function SearchBar(): JSX.Element; } diff --git a/packages/docusaurus-theme-classic/src/theme/BlogListPaginator/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogListPaginator/index.tsx index 3114bc0060..9eb127d2cb 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogListPaginator/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogListPaginator/index.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import Link from '@docusaurus/Link'; import Translate, {translate} from '@docusaurus/Translate'; +import PaginatorNavLink from '@theme/PaginatorNavLink'; import type {Props} from '@theme/BlogListPaginator'; function BlogListPaginator(props: Props): JSX.Element { @@ -24,30 +24,30 @@ function BlogListPaginator(props: Props): JSX.Element { })}>
{previousPage && ( - -
- «{' '} + Newer Entries -
- + } + /> )}
{nextPage && ( - -
+ Older Entries - {' '} - » -
- + + } + /> )}
diff --git a/packages/docusaurus-theme-classic/src/theme/BlogPostPaginator/index.tsx b/packages/docusaurus-theme-classic/src/theme/BlogPostPaginator/index.tsx index ee641e3524..2e4de53ad4 100644 --- a/packages/docusaurus-theme-classic/src/theme/BlogPostPaginator/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/BlogPostPaginator/index.tsx @@ -7,7 +7,7 @@ import React from 'react'; import Translate, {translate} from '@docusaurus/Translate'; -import Link from '@docusaurus/Link'; +import PaginatorNavLink from '@theme/PaginatorNavLink'; import type {Props} from '@theme/BlogPostPaginator'; function BlogPostPaginator(props: Props): JSX.Element { @@ -23,34 +23,30 @@ function BlogPostPaginator(props: Props): JSX.Element { })}>
{prevItem && ( - -
+ Newer Post -
-
- « {prevItem.title} -
- + } + /> )}
{nextItem && ( - -
+ Older Post -
-
- {nextItem.title} » -
- + } + /> )}
diff --git a/packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx index ae61b62e27..b30cee8136 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import {translate} from '@docusaurus/Translate'; -import DocPaginatorNavLink from '@theme/DocPaginatorNavLink'; +import Translate, {translate} from '@docusaurus/Translate'; +import PaginatorNavLink from '@theme/PaginatorNavLink'; import type {Props} from '@theme/DocPaginator'; function DocPaginator(props: Props): JSX.Element { @@ -22,10 +22,32 @@ function DocPaginator(props: Props): JSX.Element { description: 'The ARIA label for the docs pagination', })}>
- {previous && } + {previous && ( + + Previous + + } + /> + )}
- {next && } + {next && ( + + Next + + } + /> + )}
); diff --git a/packages/docusaurus-theme-classic/src/theme/DocPaginatorNavLink/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPaginatorNavLink/index.tsx deleted file mode 100644 index 4e488c0d19..0000000000 --- a/packages/docusaurus-theme-classic/src/theme/DocPaginatorNavLink/index.tsx +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import React from 'react'; -import clsx from 'clsx'; -import Link from '@docusaurus/Link'; -import Translate from '@docusaurus/Translate'; -import type {Props} from '@theme/DocPaginatorNavLink'; - -function DocPaginatorNavLink(props: Props): JSX.Element { - const {navLink, next} = props; - return ( - -
- {next ? ( - - Next - - ) : ( - - Previous - - )} -
-
{navLink.title}
- - ); -} - -export default DocPaginatorNavLink; diff --git a/packages/docusaurus-theme-classic/src/theme/PaginatorNavLink/index.tsx b/packages/docusaurus-theme-classic/src/theme/PaginatorNavLink/index.tsx new file mode 100644 index 0000000000..7ea21ee7ef --- /dev/null +++ b/packages/docusaurus-theme-classic/src/theme/PaginatorNavLink/index.tsx @@ -0,0 +1,22 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React from 'react'; +import Link from '@docusaurus/Link'; +import type {Props} from '@theme/PaginatorNavLink'; + +function PaginatorNavLink(props: Props): JSX.Element { + const {permalink, title, subLabel} = props; + return ( + + {subLabel &&
{subLabel}
} +
{title}
+ + ); +} + +export default PaginatorNavLink;