import { useParams } from 'common' import { SimpleCodeBlock } from 'ui' import { Markdown } from '../Markdown' import { PropsWithChildren } from 'react' interface ContentSnippetProps { apikey?: string endpoint?: string selectedLanguage: 'js' | 'bash' snippet: { key: string category: string title: string description?: string js?: (apikey?: string, endpoint?: string) => string bash?: (apikey?: string, endpoint?: string) => string } } const ContentSnippet = ({ apikey, endpoint, selectedLanguage, snippet, children, }: PropsWithChildren) => { const { ref: projectRef } = useParams() const codeSnippet = snippet[selectedLanguage]?.(apikey, endpoint).replaceAll( '[ref]', projectRef ?? '' ) return (

{snippet.title}

{snippet.description !== undefined && (
)}
{children} {codeSnippet !== undefined && (
{codeSnippet}
)}
) } export default ContentSnippet