refactor: import jest as global; unify import style of some modules (#6898)

* refactor: import jest as global

* fix react
This commit is contained in:
Joshua Chen 2022-03-11 19:04:27 +08:00 committed by GitHub
parent e97dc0d37e
commit c9ee6e467c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 177 additions and 139 deletions

View file

@ -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} />;

View file

@ -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;
}