docs: document MDXComponents scope (#7503)

* docs: document MDXComponents scope

* address reviews

* add info
This commit is contained in:
Joshua Chen 2022-05-26 21:50:50 +08:00 committed by GitHub
parent 06a37112bb
commit bac292d84b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 110 additions and 2 deletions

View file

@ -0,0 +1,28 @@
/**
* 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';
export default function Highlight({
children,
color,
}: {
children: ReactNode;
color: string;
}): JSX.Element {
return (
<span
style={{
backgroundColor: color,
borderRadius: '2px',
color: '#fff',
padding: '0.2rem',
}}>
{children}
</span>
);
}

View file

@ -0,0 +1,14 @@
/**
* 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 MDXComponents from '@theme-original/MDXComponents';
import Highlight from '@site/src/components/Highlight';
export default {
...MDXComponents,
highlight: Highlight,
};