mirror of
https://github.com/sct/overseerr.git
synced 2026-01-01 10:32:41 +01:00
32 lines
791 B
TypeScript
32 lines
791 B
TypeScript
import type { HTMLAttributes } from 'react';
|
|
import React from 'react';
|
|
import AceEditor from 'react-ace';
|
|
import 'ace-builds/src-noconflict/mode-json';
|
|
import 'ace-builds/src-noconflict/theme-dracula';
|
|
|
|
interface JSONEditorProps extends HTMLAttributes<HTMLDivElement> {
|
|
name: string;
|
|
value: string;
|
|
onUpdate: (value: string) => void;
|
|
}
|
|
|
|
const JSONEditor = ({ name, value, onUpdate, onBlur }: JSONEditorProps) => {
|
|
return (
|
|
<div className="w-full overflow-hidden rounded-md">
|
|
<AceEditor
|
|
mode="json"
|
|
theme="dracula"
|
|
onChange={onUpdate}
|
|
name={name}
|
|
editorProps={{ $blockScrolling: true }}
|
|
value={value}
|
|
onBlur={onBlur}
|
|
height="300px"
|
|
width="100%"
|
|
/>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default JSONEditor;
|