{({ className, style, tokens, getLineProps, getTokenProps }) => (
{
+const Code = ({ children, className = 'language-js' }) => {
const language = className.replace(/language-/, '');
return (
-
+
{({ className, style, tokens, getLineProps, getTokenProps }) => (
{
+function getSlugAndTag(path: string) {
const parts = path.split('/');
if (parts[2] === '1.5.8' || parts[2] === '2.1.4') {
@@ -34,30 +31,34 @@ const getSlugAndTag = (path) => {
return {
slug: path,
};
-};
+}
const addTagToSlug = (slug, tag) => {
return tag ? `/docs/${tag}/${slug.replace('/docs/', '')}` : slug;
};
-export const LayoutDocs = (props) => {
+interface Metadata {
+ id: string;
+ title: string;
+ description?: string;
+ toc?: boolean;
+}
+
+interface Props extends ComponentPropsWithoutRef<'div'> {
+ meta: Metadata;
+}
+
+export default function LayoutDocs({ meta, children }: Props) {
const router = useRouter();
const { slug, tag } = getSlugAndTag(router.asPath);
const { routes } = getManifest(tag);
-
- const _route = findRouteByPath(removeFromLast(slug, '#'), routes); // @ts-ignore
-
+ const _route = findRouteByPath(removeFromLast(slug, '#'), routes);
const isMobile = useIsMobile();
const { route, prevRoute, nextRoute } = getRouteContext(_route, routes);
const title = route && `${route.title}`;
return (
<>
- {tag && (
-
-
-
- )}
{isMobile ? (
<>
@@ -73,10 +74,7 @@ export const LayoutDocs = (props) => {
)}
-
+
<>
@@ -91,10 +89,8 @@ export const LayoutDocs = (props) => {
id="main-landmark"
className={s['markdown'] + ' w-full docs scroll-mt-24'}
>
-
{props.meta.title}
-
- {props.children}
-
+
{meta.title}
+ {children}
{
nextRoute={nextRoute}
/>
- {props.meta.toc === false ? null : (
+ {meta.toc === false ? null : (
{
On this page
-
+
)}
@@ -130,7 +126,7 @@ export const LayoutDocs = (props) => {
`}
>
);
-};
+}
function getCategoryPath(routes) {
const route = routes.find((r) => r.path);
@@ -196,5 +192,3 @@ function SidebarRoutes({ isMobile, routes: currentRoutes, level = 1 }) {
);
});
}
-
-LayoutDocs.displayName = 'LayoutDocs';
diff --git a/docs/src/components/LazyImage.js b/docs/src/components/LazyImage.tsx
similarity index 100%
rename from docs/src/components/LazyImage.js
rename to docs/src/components/LazyImage.tsx
diff --git a/docs/src/components/Logo.js b/docs/src/components/Logo.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/docs/src/components/MDXComponents.js b/docs/src/components/MDXComponents.js
deleted file mode 100644
index 7a25e3a57..000000000
--- a/docs/src/components/MDXComponents.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import * as React from 'react';
-import dynamic from 'next/dynamic';
-export default {
- // default tags
- pre: (p) =>
,
- code: dynamic(() => import('./Highlight2')), // Counter: dynamic(() => import('./counter')),
-};
diff --git a/docs/src/components/Markdown.js b/docs/src/components/Markdown.tsx
similarity index 100%
rename from docs/src/components/Markdown.js
rename to docs/src/components/Markdown.tsx
diff --git a/docs/src/components/Nav.js b/docs/src/components/Nav.tsx
similarity index 94%
rename from docs/src/components/Nav.js
rename to docs/src/components/Nav.tsx
index 23844292a..4f0f814c0 100644
--- a/docs/src/components/Nav.js
+++ b/docs/src/components/Nav.tsx
@@ -1,5 +1,5 @@
import Link from 'next/link';
-import { siteConfig } from 'siteConfig';
+import { siteConfig } from '@/siteConfig';
import { Search } from './Search';
export const Nav = () => (
@@ -15,11 +15,11 @@ export const Nav = () => (
-
+
-
+
diff --git a/docs/src/components/ProgressiveImage.js b/docs/src/components/ProgressiveImage.tsx
similarity index 100%
rename from docs/src/components/ProgressiveImage.js
rename to docs/src/components/ProgressiveImage.tsx
diff --git a/docs/src/components/Search.js b/docs/src/components/Search.tsx
similarity index 87%
rename from docs/src/components/Search.js
rename to docs/src/components/Search.tsx
index c2a75de75..5f0ff8de2 100644
--- a/docs/src/components/Search.js
+++ b/docs/src/components/Search.tsx
@@ -14,7 +14,7 @@ export const Search = () => {