mdx: rename getMDXComponents to useMDXComponents convention, remove ClientButton
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import type { MDXComponents } from 'mdx/types'
|
import type { MDXComponents } from 'mdx/types'
|
||||||
import { ClientButton } from '@/components/blog/button-client'
|
|
||||||
|
|
||||||
export function getMDXComponents(components: MDXComponents): MDXComponents {
|
|
||||||
|
export function useMDXComponents(components: MDXComponents): MDXComponents {
|
||||||
return {
|
return {
|
||||||
...components,
|
...components,
|
||||||
// Typography
|
// Typography
|
||||||
@@ -106,10 +106,5 @@ export function getMDXComponents(components: MDXComponents): MDXComponents {
|
|||||||
// Collapsible sections
|
// Collapsible sections
|
||||||
details: (props) => <details className="my-4 rounded-lg border border-border p-4" {...props} />,
|
details: (props) => <details className="my-4 rounded-lg border border-border p-4" {...props} />,
|
||||||
summary: (props) => <summary className="cursor-pointer font-semibold" {...props} />,
|
summary: (props) => <summary className="cursor-pointer font-semibold" {...props} />,
|
||||||
|
|
||||||
button: ({ children, onClick, ...props }) => {
|
|
||||||
const onClickString = typeof onClick === 'string' ? onClick : undefined
|
|
||||||
return <ClientButton onClick={onClickString} {...props}>{children}</ClientButton>
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user