mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 19:35:06 +03:00
* Do up logic for callback for opening side panel * Add TextEditor side panel and fix some quirky bugs with JSONEditor too * Add Markdown Preview in TextEditor * Fix bad cs * Fix border css
30 lines
781 B
TypeScript
30 lines
781 B
TypeScript
import { ReactMarkdown, ReactMarkdownOptions } from 'react-markdown/lib/react-markdown'
|
|
import { cn } from 'ui'
|
|
|
|
interface Props extends Omit<ReactMarkdownOptions, 'children' | 'node'> {
|
|
className?: string
|
|
content: string
|
|
extLinks?: boolean
|
|
}
|
|
|
|
const Markdown = ({ className, content = '', extLinks = false, ...props }: Props) => {
|
|
return (
|
|
<ReactMarkdown
|
|
components={{
|
|
h3: ({ children }) => <h3 className="mb-1">{children}</h3>,
|
|
a: ({ href, children }) => (
|
|
<a href={href} target={extLinks ? '_blank' : ''} rel={extLinks ? 'noreferrer' : ''}>
|
|
{children}
|
|
</a>
|
|
),
|
|
}}
|
|
{...props}
|
|
className={cn('prose text-sm', className)}
|
|
>
|
|
{content}
|
|
</ReactMarkdown>
|
|
)
|
|
}
|
|
|
|
export { Markdown }
|