mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-19 13:56:04 +00:00
public commit
This commit is contained in:
22
app/src/ui/components/code/JsonEditor.tsx
Normal file
22
app/src/ui/components/code/JsonEditor.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { json } from "@codemirror/lang-json";
|
||||
import type { ReactCodeMirrorProps } from "@uiw/react-codemirror";
|
||||
import { Suspense, lazy } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
const CodeEditor = lazy(() => import("./CodeEditor"));
|
||||
|
||||
export function JsonEditor({ editable, className, ...props }: ReactCodeMirrorProps) {
|
||||
return (
|
||||
<Suspense fallback={null}>
|
||||
<CodeEditor
|
||||
className={twMerge(
|
||||
"flex w-full border border-muted",
|
||||
!editable && "opacity-70",
|
||||
className
|
||||
)}
|
||||
editable={editable}
|
||||
extensions={[json()]}
|
||||
{...props}
|
||||
/>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user