mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-26 13:08:11 +00:00
Globally import Tabs and TabItem
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
import Head from '@docusaurus/Head';
|
||||
// MDX elements are wrapped through the MDX pragma. In some cases (notably usage
|
||||
// with Head/Helmet) we need to unwrap those elements.
|
||||
function unwrapMDXElement(element) {
|
||||
if (element.props?.mdxType && element.props.originalType) {
|
||||
const {mdxType, originalType, ...newProps} = element.props;
|
||||
return React.createElement(element.props.originalType, newProps);
|
||||
}
|
||||
return element;
|
||||
}
|
||||
export default function MDXHead(props) {
|
||||
const unwrappedChildren = React.Children.map(props.children, (child) =>
|
||||
React.isValidElement(child) ? unwrapMDXElement(child) : child,
|
||||
);
|
||||
return <Head {...props}>{unwrappedChildren}</Head>;
|
||||
}
|
||||
Reference in New Issue
Block a user