mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 22:17:00 +02:00
feat(theme-common): JSDoc for all APIs (#6974)
* feat(theme-common): JSDoc for all APIs * fix tests
This commit is contained in:
parent
4103fef11e
commit
b456a64f61
48 changed files with 871 additions and 679 deletions
|
@ -20,7 +20,10 @@ interface PageMetadataProps {
|
|||
readonly children?: ReactNode;
|
||||
}
|
||||
|
||||
// Helper component to manipulate page metadata and override site defaults
|
||||
/**
|
||||
* Helper component to manipulate page metadata and override site defaults.
|
||||
* Works in the same way as Helmet.
|
||||
*/
|
||||
export function PageMetadata({
|
||||
title,
|
||||
description,
|
||||
|
@ -44,6 +47,7 @@ export function PageMetadata({
|
|||
<meta
|
||||
name="keywords"
|
||||
content={
|
||||
// https://github.com/microsoft/TypeScript/issues/17002
|
||||
(Array.isArray(keywords) ? keywords.join(',') : keywords) as string
|
||||
}
|
||||
/>
|
||||
|
@ -59,8 +63,12 @@ export function PageMetadata({
|
|||
|
||||
const HtmlClassNameContext = React.createContext<string | undefined>(undefined);
|
||||
|
||||
// This wrapper is necessary because Helmet does not "merge" classes
|
||||
// See https://github.com/staylor/react-helmet-async/issues/161
|
||||
/**
|
||||
* Every layer of this provider will append a class name to the HTML element.
|
||||
* There's no consumer for this hook: it's side-effect-only. This wrapper is
|
||||
* necessary because Helmet does not "merge" classes.
|
||||
* @see https://github.com/staylor/react-helmet-async/issues/161
|
||||
*/
|
||||
export function HtmlClassNameProvider({
|
||||
className: classNameProp,
|
||||
children,
|
||||
|
@ -87,6 +95,10 @@ function pluginNameToClassName(pluginName: string) {
|
|||
)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* A very thin wrapper around `HtmlClassNameProvider` that adds the plugin ID +
|
||||
* name to the HTML class name.
|
||||
*/
|
||||
export function PluginHtmlClassNameProvider({
|
||||
children,
|
||||
}: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue