mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 08:49:51 +02:00
refactor: import jest as global; unify import style of some modules (#6898)
* refactor: import jest as global * fix react
This commit is contained in:
parent
e97dc0d37e
commit
c9ee6e467c
59 changed files with 177 additions and 139 deletions
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
import React, {
|
||||
type ComponentProps,
|
||||
isValidElement,
|
||||
type ComponentProps,
|
||||
type ReactElement,
|
||||
} from 'react';
|
||||
import Head from '@docusaurus/Head';
|
||||
|
@ -52,7 +52,7 @@ const MDXComponents: MDXComponentsObject = {
|
|||
const shouldBeInline = React.Children.toArray(props.children).every(
|
||||
(el) =>
|
||||
(typeof el === 'string' && !el.includes('\n')) ||
|
||||
(React.isValidElement(el) && inlineElements.includes(el.props.mdxType)),
|
||||
(isValidElement(el) && inlineElements.includes(el.props.mdxType)),
|
||||
);
|
||||
|
||||
return shouldBeInline ? <code {...props} /> : <CodeBlock {...props} />;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import React, {
|
||||
useState,
|
||||
cloneElement,
|
||||
Children,
|
||||
isValidElement,
|
||||
type ReactElement,
|
||||
} from 'react';
|
||||
|
@ -40,7 +39,7 @@ function TabsComponent(props: Props): JSX.Element {
|
|||
groupId,
|
||||
className,
|
||||
} = props;
|
||||
const children = Children.map(props.children, (child) => {
|
||||
const children = React.Children.map(props.children, (child) => {
|
||||
if (isValidElement(child) && isTabItem(child)) {
|
||||
return child;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue