/* eslint-disable react/display-name */
import {clsx} from "@nextui-org/shared-utils";
import * as Components from "@nextui-org/react";
import {Language} from "prism-react-renderer";
import NextImage from "next/image";
import {ThemeSwitch} from "./theme-switch";
import {Sandpack} from "@/components/sandpack";
import * as DocsComponents from "@/components/docs/components";
import {Codeblock} from "@/components/docs/components";
import {VirtualAnchor, virtualAnchorEncode} from "@/components";
const Table: React.FC<{children?: React.ReactNode}> = ({children}) => {
return (
);
};
const Thead: React.FC<{children?: React.ReactNode}> = ({children}) => {
return (
tr]:h-12",
"[&>tr>th]:py-0",
"[&>tr>th]:align-middle",
"[&>tr>th]:bg-default-400/20",
"dark:[&>tr>th]:bg-default-600/10",
"[&>tr>th]:text-default-600 [&>tr>th]:text-xs",
"[&>tr>th]:text-left [&>tr>th]:pl-2",
"[&>tr>th:first-child]:rounded-l-lg",
"[&>tr>th:last-child]:rounded-r-lg",
)}
>
{children}
);
};
const Trow: React.FC<{children?: React.ReactNode}> = ({children}) => {
return {children} ;
};
const Tcol: React.FC<{children?: React.ReactNode}> = ({children}) => {
return (
{children}
);
};
export interface LinkedHeadingProps {
as: keyof JSX.IntrinsicElements;
id?: string;
linked?: boolean;
children?: React.ReactNode;
className?: string;
}
const linkedLevels: Record = {
h1: 0,
h2: 1,
h3: 2,
h4: 3,
};
const LinkedHeading: React.FC = ({
as,
linked = true,
id: idProp,
className,
...props
}) => {
const Component = as;
const level = linkedLevels[as] || 1;
let id = idProp || virtualAnchorEncode(props.children as string);
return (
{linked ? {props.children} : <>{props.children}>}
);
};
const List: React.FC<{children?: React.ReactNode}> = ({children}) => {
return (
);
};
const InlineCode = ({children}: {children?: React.ReactNode}) => {
return (
{children}
);
};
const Code = ({
className,
children,
meta,
}: {
children?: React.ReactNode;
className?: string;
meta?: string;
}) => {
const isMultiLine = (children as string)?.split?.("\n")?.length > 2;
const language = (className?.replace(/language-/, "") ?? "jsx") as Language;
const codeString = String(children).trim();
if (!className) {
return {children} ;
}
return (
);
};
const Link = ({href, children}: {href?: string; children?: React.ReactNode}) => {
const isExternal = href?.startsWith("http");
return (
{children}
);
};
export const MDXComponents = {
/**
* Next.js components
*/
NextImage,
/**
* NextUI components
*/
...Components,
/**
* Docs components
*/
...DocsComponents,
Sandpack,
ThemeSwitch,
/**
* Markdown components
*/
// ...Icons,
h1: (props: React.HTMLAttributes) => (
),
h2: (props: React.HTMLAttributes) => ,
h3: (props: React.HTMLAttributes) => ,
h4: (props: React.HTMLAttributes) => ,
strong: (props: React.HTMLAttributes) => (
),
table: Table,
thead: Thead,
tr: Trow,
td: Tcol,
// CarbonAd,
code: Code,
ul: List,
a: (props: React.HTMLAttributes) => ,
blockquote: (props: Omit, "color">) => (
),
kbd: (props: React.HTMLAttributes) => (
),
Steps: ({...props}) => (
),
// Block,
} as unknown as Record;