mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 01:15:03 +03:00
28 lines
833 B
TypeScript
28 lines
833 B
TypeScript
import { useEffect, useState } from 'react'
|
|
|
|
import { Markdown } from '@/components/interfaces/Markdown'
|
|
|
|
interface MarkdownContentProps {
|
|
content: string | null | undefined
|
|
integrationId?: string
|
|
}
|
|
|
|
export const MarkdownContent = ({
|
|
content: remoteContent,
|
|
integrationId,
|
|
}: MarkdownContentProps) => {
|
|
const [localContent, setLocalContent] = useState<string>('')
|
|
|
|
const content = remoteContent || localContent
|
|
|
|
useEffect(() => {
|
|
if (!!integrationId && !content) {
|
|
import(`@/static-data/integrations/${integrationId}/overview.md`)
|
|
.then((module) => setLocalContent(String(module.default)))
|
|
.catch((error) => console.error('Error loading markdown:', error))
|
|
}
|
|
}, [integrationId, content])
|
|
|
|
return <Markdown className="flex flex-col gap-y-4 text-foreground-light">{content}</Markdown>
|
|
}
|