mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-05-06 05:03:27 +00:00
Merge pull request #1109 from btat/unused-files
Global tab import - remove unused files
This commit is contained in:
@@ -10,8 +10,8 @@ export default {
|
||||
// Re-use the default mapping
|
||||
...MDXComponents,
|
||||
|
||||
Tabs,
|
||||
TabItem,
|
||||
Tabs: Tabs,
|
||||
TabItem: TabItem,
|
||||
|
||||
CardSection,
|
||||
Card,
|
||||
@@ -1,5 +0,0 @@
|
||||
import React from 'react';
|
||||
import Link from '@docusaurus/Link';
|
||||
export default function MDXA(props) {
|
||||
return <Link {...props} />;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
import React, {isValidElement} from 'react';
|
||||
import CodeBlock from '@theme/CodeBlock';
|
||||
export default function MDXCode(props) {
|
||||
const inlineElements = [
|
||||
'a',
|
||||
'abbr',
|
||||
'b',
|
||||
'br',
|
||||
'button',
|
||||
'cite',
|
||||
'code',
|
||||
'del',
|
||||
'dfn',
|
||||
'em',
|
||||
'i',
|
||||
'img',
|
||||
'input',
|
||||
'ins',
|
||||
'kbd',
|
||||
'label',
|
||||
'object',
|
||||
'output',
|
||||
'q',
|
||||
'ruby',
|
||||
's',
|
||||
'small',
|
||||
'span',
|
||||
'strong',
|
||||
'sub',
|
||||
'sup',
|
||||
'time',
|
||||
'u',
|
||||
'var',
|
||||
'wbr',
|
||||
];
|
||||
const shouldBeInline = React.Children.toArray(props.children).every(
|
||||
(el) =>
|
||||
(typeof el === 'string' && !el.includes('\n')) ||
|
||||
(isValidElement(el) && inlineElements.includes(el.props?.mdxType)),
|
||||
);
|
||||
return shouldBeInline ? <code {...props} /> : <CodeBlock {...props} />;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import React from 'react';
|
||||
import Details from '@theme/Details';
|
||||
export default function MDXDetails(props) {
|
||||
const items = React.Children.toArray(props.children);
|
||||
// Split summary item from the rest to pass it as a separate prop to the
|
||||
// Details theme component
|
||||
const summary = items.find(
|
||||
(item) => React.isValidElement(item) && item.props?.mdxType === 'summary',
|
||||
);
|
||||
const children = <>{items.filter((item) => item !== summary)}</>;
|
||||
return (
|
||||
<Details {...props} summary={summary}>
|
||||
{children}
|
||||
</Details>
|
||||
);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
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>;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import React from 'react';
|
||||
import Heading from '@theme/Heading';
|
||||
export default function MDXHeading(props) {
|
||||
return <Heading {...props} />;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import React, {isValidElement} from 'react';
|
||||
import CodeBlock from '@theme/CodeBlock';
|
||||
export default function MDXPre(props) {
|
||||
return (
|
||||
<CodeBlock
|
||||
// If this pre is created by a ``` fenced codeblock, unwrap the children
|
||||
{...(isValidElement(props.children) &&
|
||||
props.children.props?.originalType === 'code'
|
||||
? props.children.props
|
||||
: {...props})}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
import React from 'react';
|
||||
import MDXHead from '@theme/MDXComponents/Head';
|
||||
import MDXCode from '@theme/MDXComponents/Code';
|
||||
import MDXA from '@theme/MDXComponents/A';
|
||||
import MDXPre from '@theme/MDXComponents/Pre';
|
||||
import MDXDetails from '@theme/MDXComponents/Details';
|
||||
import MDXHeading from '@theme/MDXComponents/Heading';
|
||||
import MDXUl from '@theme/MDXComponents/Ul';
|
||||
import MDXImg from '@theme/MDXComponents/Img';
|
||||
import Admonition from '@theme/Admonition';
|
||||
import Mermaid from '@theme/Mermaid';
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
const MDXComponents = {
|
||||
head: MDXHead,
|
||||
code: MDXCode,
|
||||
a: MDXA,
|
||||
pre: MDXPre,
|
||||
details: MDXDetails,
|
||||
ul: MDXUl,
|
||||
img: MDXImg,
|
||||
h1: (props) => <MDXHeading as="h1" {...props} />,
|
||||
h2: (props) => <MDXHeading as="h2" {...props} />,
|
||||
h3: (props) => <MDXHeading as="h3" {...props} />,
|
||||
h4: (props) => <MDXHeading as="h4" {...props} />,
|
||||
h5: (props) => <MDXHeading as="h5" {...props} />,
|
||||
h6: (props) => <MDXHeading as="h6" {...props} />,
|
||||
admonition: Admonition,
|
||||
mermaid: Mermaid,
|
||||
Tabs: Tabs,
|
||||
TabItem: TabItem,
|
||||
};
|
||||
export default MDXComponents;
|
||||
Reference in New Issue
Block a user