portfolio/mdx-components.tsx
Ryan Freeman 66852789c0
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m11s
Add copy button to pre components
2025-04-10 22:58:15 +01:00

21 lines
871 B
TypeScript

import type {MDXComponents} from 'mdx/types'
import React from 'react'
import {Code} from '@/components/ui/Code'
import {Heading} from './components/ui/Heading'
// This file allows you to provide custom React components
// to be used in MDX files. You can import and use any
// React component you want, including components from
// other libraries.
// This file is required to use MDX in `app` directory.
export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
h2: ({children}) => <Heading as="h2">{children}</Heading>,
h3: ({children}) => <Heading as="h3">{children}</Heading>,
pre: ({children}) => <Code>{children}</Code>,
// Allows customizing built-in components, e.g. to add styling.
// h1: ({ children }) => <h1 style={{ fontSize: "100px" }}>{children}</h1>,
...components
}
}