Files
supabase/studio/components/interfaces/Docs/CodeSnippet.tsx
T
Joshen Lim 30375c55a0 Chore/revert changes to api docs (#18865)
* Reinstate API docs files and pages

* Add API side panel back to feature preview

* Nav bar to link to api page if feature is not toggled

* Hide API docs button behind feature preview for auth users, storage and edge functions

* Use new API side panel for table editor, and update the language selector to make it more apparent

* Fix feature preview modal styling

* Merge master resolve conflicts

* Add URL to graphiql in API docs side panel, which links to /api/graphiql without the docs layout menu

* Add auth enabled flag for user management section in Docs

* Add realtime enabled flag for subscribe to changes section in Docs

* Add realtime enabled flag for API docs side panel

* Update redirect next config
2023-11-13 13:56:09 +08:00

24 lines
633 B
TypeScript

import SimpleCodeBlock from 'components/to-be-cleaned/SimpleCodeBlock'
interface CodeSnippetProps {
selectedLang: 'bash' | 'js'
snippet: {
title?: string
bash: { language?: string; code: string }
js?: { language?: string; code: string }
}
}
const CodeSnippet = ({ selectedLang, snippet }: CodeSnippetProps) => {
if (!snippet[selectedLang]) return null
return (
<div className="codeblock-container">
<h4>{snippet.title}</h4>
<SimpleCodeBlock className={snippet[selectedLang]?.language}>
{snippet[selectedLang]?.code}
</SimpleCodeBlock>
</div>
)
}
export default CodeSnippet