diff --git a/packages/docusaurus-theme-classic/package.json b/packages/docusaurus-theme-classic/package.json index 5a0b364a5f..eeb5ee859d 100644 --- a/packages/docusaurus-theme-classic/package.json +++ b/packages/docusaurus-theme-classic/package.json @@ -36,7 +36,7 @@ "clsx": "^1.1.1", "copy-text-to-clipboard": "^3.0.1", "globby": "^11.0.2", - "infima": "0.2.0-alpha.36", + "infima": "0.2.0-alpha.37", "lodash": "^4.17.20", "postcss": "^8.3.7", "prism-react-renderer": "^1.2.1", diff --git a/packages/docusaurus-theme-classic/src/theme-classic.d.ts b/packages/docusaurus-theme-classic/src/theme-classic.d.ts index b680d9d931..fb781f4adb 100644 --- a/packages/docusaurus-theme-classic/src/theme-classic.d.ts +++ b/packages/docusaurus-theme-classic/src/theme-classic.d.ts @@ -123,13 +123,22 @@ declare module '@theme/CodeBlock' { declare module '@theme/DocPaginator' { import type {PropNavigation} from '@docusaurus/plugin-content-docs'; - type PageInfo = {readonly permalink: string; readonly title: string}; - // May be simpler to provide a {navigation: PropNavigation} prop? export interface Props extends PropNavigation {} - const DocPaginator: (props: Props) => JSX.Element; - export default 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' { diff --git a/packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx index 119bfa328d..ae61b62e27 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocPaginator/index.tsx @@ -6,11 +6,11 @@ */ import React from 'react'; -import Link from '@docusaurus/Link'; -import Translate, {translate} from '@docusaurus/Translate'; -import type {PropNavigation} from '@docusaurus/plugin-content-docs'; +import {translate} from '@docusaurus/Translate'; +import DocPaginatorNavLink from '@theme/DocPaginatorNavLink'; +import type {Props} from '@theme/DocPaginator'; -function DocPaginator(props: PropNavigation): JSX.Element { +function DocPaginator(props: Props): JSX.Element { const {previous, next} = props; return ( @@ -22,34 +22,10 @@ function DocPaginator(props: PropNavigation): JSX.Element { description: 'The ARIA label for the docs pagination', })}>
- {previous && ( - -
- - Previous - -
-
- « {previous.title} -
- - )} + {previous && }
- {next && ( - -
- - Next - -
-
{next.title} »
- - )} + {next && }
); diff --git a/packages/docusaurus-theme-classic/src/theme/DocPaginatorNavLink/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPaginatorNavLink/index.tsx new file mode 100644 index 0000000000..4e488c0d19 --- /dev/null +++ b/packages/docusaurus-theme-classic/src/theme/DocPaginatorNavLink/index.tsx @@ -0,0 +1,38 @@ +/** + * 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/yarn.lock b/yarn.lock index 52d8b5c269..cb85722e7f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10645,10 +10645,10 @@ infer-owner@^1.0.3, infer-owner@^1.0.4: resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" integrity sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A== -infima@0.2.0-alpha.36: - version "0.2.0-alpha.36" - resolved "https://registry.yarnpkg.com/infima/-/infima-0.2.0-alpha.36.tgz#205515680e2dc588ec1a07b6ce108e49b29cc810" - integrity sha512-tlhQa7S09+QzQs8hCZ9oBeD6xOFap1f2zDO4I5HRZ4SMFKKGk9sIhwaou1FWpYoqM6aaoK2YN+G1fND+Sad1Qw== +infima@0.2.0-alpha.37: + version "0.2.0-alpha.37" + resolved "https://registry.yarnpkg.com/infima/-/infima-0.2.0-alpha.37.tgz#b87ff42d528d6d050098a560f0294fbdd12adb78" + integrity sha512-4GX7Baw+/lwS4PPW/UJNY89tWSvYG1DL6baKVdpK6mC593iRgMssxNtORMTFArLPJ/A/lzsGhRmx+z6MaMxj0Q== inflight@^1.0.4: version "1.0.6"