docs: better code snippets (#2801)

Uses sandpack in all places so we can do richer code snippets.
Also, drive-by fix to fix sidebar logic.
Also, drive-by fix to hide keyboard hint (Cmd+K) for search on mobile.

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]

### Release Notes

- Docs: reworks code snippets
This commit is contained in:
Mime Čuvalo 2024-02-12 14:30:55 +00:00 committed by GitHub
parent a5e6ae87fe
commit 430924f8b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 97 additions and 44 deletions

View file

@ -1,6 +1,6 @@
'use client'
import { SandpackCodeEditor, SandpackFiles, SandpackProvider } from '@codesandbox/sandpack-react'
import { SandpackCodeViewer, SandpackFiles, SandpackProvider } from '@codesandbox/sandpack-react'
import { useTheme } from 'next-themes'
import { useEffect, useState } from 'react'
@ -43,7 +43,7 @@ export default function ExampleCodeBlock({
}}
theme={theme === 'dark' ? 'dark' : 'light'}
>
<SandpackCodeEditor readOnly />
<SandpackCodeViewer />
</SandpackProvider>
</div>
)