"use client"; import { Alert, Badge, Card, Text } from "@/components/retroui"; import { useMDXComponent } from "next-contentlayer/hooks"; import React, { AnchorHTMLAttributes, HTMLAttributes } from "react"; import { ComponentShowcase } from "./ComponentShowcase"; import { cn } from "@/lib/utils"; import { ComponentSource } from "./ComponentSource"; import { CodeBlock } from "./CodeBlock"; import Link from "next/link"; import { ComponentInstall, CliCommand } from "./ComponentInstall"; import Image from "next/image"; import { Tab, TabGroup, TabList, TabPanel, TabPanels } from "@headlessui/react"; import { Table } from "./retroui/Table"; const components = (type: "doc" | "blog") => ({ h1: (props: HTMLAttributes) => ( ), h2: (props: HTMLAttributes) => type === "blog" ? ( ) : ( ), h3: (props: HTMLAttributes) => ( ), h4: (props: HTMLAttributes) => ( ), h5: (props: HTMLAttributes) => , h6: (props: HTMLAttributes) => , p: (props: HTMLAttributes) => type === "blog" ? ( ) : ( ), li: (props: HTMLAttributes) => type === "blog" ? ( ) : ( ), img: (props: HTMLAttributes) => ( ), a: (props: AnchorHTMLAttributes) => { const { href, target, rel, ...rest } = props; if (!href) { return ; } const isExternal = href.startsWith("http"); return isExternal ? ( ) : ( ); }, pre: CodeBlock, code: ({ className, children, ...props }: React.HTMLAttributes) => ( {children} ), TabGroup, TabList, Tab, TabPanels, TabPanel, Table, Link, Badge, Image, Card, Alert, ComponentShowcase, ComponentSource, ComponentInstall, CliCommand, }); export default function MDX({ code, type = "doc", }: { code: string; type?: "doc" | "blog"; }) { const Content = useMDXComponent(code); return ; }