diff --git a/src/components/AttributeTable/ListItem/index.js b/src/components/AttributeTable/ListItem/index.js deleted file mode 100644 index 7d06d4ae57..0000000000 --- a/src/components/AttributeTable/ListItem/index.js +++ /dev/null @@ -1,57 +0,0 @@ -import React from "react"; -import Details from "@theme/Details"; - -import { combineAdjacentStrings, partition } from "@site/src/helpers"; - -import styles from "./styles.module.scss"; -import Translate from "@docusaurus/Translate"; - -export const ListItem = (props) => { - const children = props.children.props.children.filter((child) => child !== "\n"); - - const [name, sublist] = children; - - const [typeElement, descriptionElement] = sublist.props.children.filter((child) => child !== "\n"); - - const type = - typeElement.props.children === "skip" ? null : typeElement.props.children; - - const [description, collapsedChildren] = partition( - React.Children.toArray(descriptionElement.props.children), - (child) => child?.type?.name !== "MDXUl" && child?.type?.name !== "ul", - ); - - const collapsedList = []; - collapsedChildren.length > 0 && collapsedChildren[0].props.children - .filter((child) => child !== "\n") - .map((child, index) => { - collapsedList.push( - {child}, - ); - }); - - return ( -
  • -

    - {name} - {type} -

    - -

    {description}

    - - {collapsedList.length > 0 && ( -
    - - Show child attributes - - - }> - {collapsedList} -
    - )} -
  • - ); -}; diff --git a/src/components/AttributeTable/index.js b/src/components/AttributeTable/index.tsx similarity index 79% rename from src/components/AttributeTable/index.js rename to src/components/AttributeTable/index.tsx index fef1b2b007..b5d5070867 100644 --- a/src/components/AttributeTable/index.js +++ b/src/components/AttributeTable/index.tsx @@ -1,11 +1,9 @@ -import React from "react"; - +import React, { type ReactNode } from "react"; import { ListItem } from "./ListItem"; import styles from "./styles.module.scss"; -export const AttributeTable = ({ children }) => { - +export function AttributeTable({ children }): ReactNode { const renderArray = []; children.props.children .filter((child) => child !== "\n") diff --git a/src/components/CodeExample.js b/src/components/CodeExample.js deleted file mode 100644 index 47ea63b7b7..0000000000 --- a/src/components/CodeExample.js +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react'; -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; -import CodeBlock from '@theme/CodeBlock'; -import { CODE_LANGS } from "@site/config/constants"; -import Translate from '@docusaurus/Translate'; - -export const CodeExample = ({ children }) => ( - - {React.Children.map(children, (child, index) => { - const codeProps = child.props.children.props; - const { className = '' } = codeProps; - - const [, language] = className.split('-'); - - return ( - - Example - - } - > - - {codeProps.children} - - - ); - })} - -); diff --git a/src/components/CodeExample.tsx b/src/components/CodeExample.tsx new file mode 100644 index 0000000000..ced4b65408 --- /dev/null +++ b/src/components/CodeExample.tsx @@ -0,0 +1,37 @@ +import React, { type ReactNode } from 'react'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import CodeBlock from '@theme/CodeBlock'; +import { CODE_LANGS } from "@site/config/constants"; +import Translate from '@docusaurus/Translate'; + +export function CodeExample({ children }): ReactNode { + return ( + + {React.Children.map(children, (child, index) => { + const codeProps = child.props.children.props; + const { className = '' } = codeProps; + + const [, language] = className.split('-'); + + return ( + + Example + + } + > + + {codeProps.children} + + + ); + })} + + ); +}; diff --git a/src/components/EndpointsTable.js b/src/components/EndpointsTable.tsx similarity index 57% rename from src/components/EndpointsTable.js rename to src/components/EndpointsTable.tsx index a2db54903d..bec60fbd94 100644 --- a/src/components/EndpointsTable.js +++ b/src/components/EndpointsTable.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { type ReactNode } from "react"; import { MethodTable } from "./MethodTable"; import Translate from "@docusaurus/Translate"; @@ -10,6 +10,8 @@ const transledEndpoints = ( ) -export const EndpointsTable = ({ children, title = transledEndpoints }) => ( - {children} -); +export function EndpointsTable({ children, title = transledEndpoints }): ReactNode { + return ( + {children} + ); +}; diff --git a/src/components/RedirectPage.js b/src/components/RedirectPage.js deleted file mode 100644 index 3672c5cf2e..0000000000 --- a/src/components/RedirectPage.js +++ /dev/null @@ -1,16 +0,0 @@ -import React, { useEffect } from 'react'; -import PropTypes from 'prop-types'; - -function RedirectPage({ to }) { - useEffect(() => { - window.location.href = to; - }, [to]); - - return null; -} - -RedirectPage.propTypes = { - to: PropTypes.string.isRequired, -}; - -export default RedirectPage; \ No newline at end of file diff --git a/src/components/RedirectPage.tsx b/src/components/RedirectPage.tsx new file mode 100644 index 0000000000..4b6cd96279 --- /dev/null +++ b/src/components/RedirectPage.tsx @@ -0,0 +1,11 @@ +import React, { useEffect, type ReactNode } from 'react'; + +export function RedirectPage({ to }: { to: string }): ReactNode { + useEffect(() => { + window.location.href = to; + }, [to]); + + return null; +} + +export default RedirectPage; diff --git a/src/components/WrapperApiReference.js b/src/components/WrapperApiReference.tsx similarity index 87% rename from src/components/WrapperApiReference.js rename to src/components/WrapperApiReference.tsx index 2a16427dbd..3eb7e909a3 100644 --- a/src/components/WrapperApiReference.js +++ b/src/components/WrapperApiReference.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { type ReactNode } from "react"; import clsx from "clsx"; import { partition } from "@site/src/helpers"; @@ -11,7 +11,7 @@ const RIGHT_COLUMN_COMPONENTS_NAME = { table: "table", }; -export const WrapperApiReference = ({ children, ...props }) => { +export function WrapperApiReference({ children, ...props }): ReactNode { const [rightColumnContent, middleColumnContent] = React.useMemo( () => partition( diff --git a/src/components/YouTube.js b/src/components/YouTube.js deleted file mode 100644 index 848d9adcdd..0000000000 --- a/src/components/YouTube.js +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -const YouTube = ({ ID }) => ( -
    - -
    -); - -YouTube.propTypes = { - ID: PropTypes.string.isRequired, -}; - -export default YouTube; \ No newline at end of file diff --git a/src/components/YouTube/index.tsx b/src/components/YouTube/index.tsx new file mode 100644 index 0000000000..6babf82b55 --- /dev/null +++ b/src/components/YouTube/index.tsx @@ -0,0 +1,31 @@ +import React, { type ReactNode } from 'react'; + +export function YouTube({ ID }: { ID: string; }): ReactNode { + return ( +
    + +
    + ); +}; + +export default YouTube;