'use client' import { CH } from '@code-hike/mdx/components' import dynamic from 'next/dynamic' import { ArrowUpRight, Triangle } from 'lucide-react' import { Badge, cn, Collapsible_Shadcn_, CollapsibleContent_Shadcn_, CollapsibleTrigger_Shadcn_, Heading, Image, Mermaid, } from 'ui' import { Admonition } from 'ui-patterns/admonition' import type { PropsWithChildren } from 'react' import type { ImageProps } from 'ui/src/components/Image/Image' const Avatar = dynamic(() => import('~/components/Avatar')) const Chart = dynamic(() => import('~/components/Charts/PGCharts')) const CodeBlock = dynamic(() => import('~/components/CodeBlock/CodeBlock')) const Tabs = dynamic(() => import('~/components/Tabs/Tabs'), { ssr: false }) const TabPanel = dynamic( () => import('~/components/Tabs/Tabs').then((mod) => ({ default: mod.TabPanel })), { ssr: false } ) const NamedCodeBlock = dynamic( () => import('~/components/CodeTabs').then((mod) => ({ default: mod.NamedCodeBlock, })), { ssr: false, } ) const ImageFadeStack = dynamic(() => import('~/components/ImageFadeStack')) const ImageGrid = dynamic(() => import('~/components/ImageGrid')) const InlineCodeTag = dynamic(() => import('~/components/InlineCode')) const Quote = dynamic(() => import('~/components/Quote')) // import all components used in blog articles here // to do: move this into a helper/utils, it is used elsewhere const ignoreClass = 'ignore-on-export' const LinkComponent = (props: PropsWithChildren) => ( {props.children}{' '} {props.target === '_blank' && } ) const BlogCollapsible = ({ title, containerClassName, ...props }: { title: string containerClassName?: string }) => { return ( {title} ) } export default function mdxComponents(type?: 'blog' | 'lp' | undefined) { const components = { CodeBlock, Tabs, TabPanel, NamedCodeBlock, CH, h1: (props: any) => , h2: (props: any) => , h3: (props: any) => , h4: (props: any) => , h5: (props: any) => , h6: (props: any) => , Badge, Quote, Avatar, PGChart: (props: any) => { return }, pre: (props: any) => { if (props.className !== ignoreClass) { const childProps = props.children?.props // Detect mermaid code blocks and render with Mermaid component if (childProps?.className === 'language-mermaid') { return } return } else { return } }, ImageGrid, ImageFadeStack, img: (props: any) => { if (props.className !== ignoreClass) { return ( ) } // biome-ignore lint/a11y/useAltText: provided in props return }, Img: ({ zoomable = true, className, ...props }: ImageProps & { wide?: boolean }) => ( ), Link: LinkComponent, code: (props: any) => {props.children}, BlogCollapsible: (props: any) => , Subtitle: (props: any) => (

), Admonition, Mermaid, } return components as any }