/
githubmirror
/
docusaurus
Обзор
Документация
Войти
/
githubmirror
/
docusaurus
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/docusaurus-theme-classic/src/theme/DocVersionRoot/index.tsx
51 строка
1 KB
Sébastien Lorber
refactor: prepare types for React 19 (#10746)
06 дек 2024, 20:03
Не верифицирован
06 дек 2024, 20:03
f9825af
Код
Авторство
О чём код?
/** * 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, {type ReactNode} from 'react'; import {HtmlClassNameProvider, PageMetadata} from '@docusaurus/theme-common'; import { getDocsVersionSearchTag, DocsVersionProvider, } from '@docusaurus/plugin-content-docs/client'; import renderRoutes from '@docusaurus/renderRoutes'; import SearchMetadata from '@theme/SearchMetadata'; import type {Props} from '@theme/DocVersionRoot'; function DocVersionRootMetadata(props: Props): ReactNode { const {version} = props; return ( <> <SearchMetadata version={version.version} tag={getDocsVersionSearchTag(version.pluginId, version.version)} /> <PageMetadata> {version.noIndex && <meta name="robots" content="noindex, nofollow" />} </PageMetadata> </> ); } function DocVersionRootContent(props: Props): ReactNode { const {version, route} = props; return ( <HtmlClassNameProvider className={version.className}> <DocsVersionProvider version={version}> {renderRoutes(route.routes!)} </DocsVersionProvider> </HtmlClassNameProvider> ); } export default function DocVersionRoot(props: Props): ReactNode { return ( <> <DocVersionRootMetadata {...props} /> <DocVersionRootContent {...props} /> </> ); }