Worldshaper/src/components/RawJsonSection.tsx

31 lines
758 B
TypeScript
Raw Normal View History

2026-06-26 18:18:14 -04:00
type RawJsonSectionProps = {
isAllRecordsSelected: boolean;
hasSelectedRecord: boolean;
recordJsonDraft: string;
jsonText: string;
onRawJsonEditorChange: (nextText: string) => void;
};
export default function RawJsonSection(props: RawJsonSectionProps) {
const {
isAllRecordsSelected,
hasSelectedRecord,
recordJsonDraft,
jsonText,
onRawJsonEditorChange,
} = props;
return (
<>
<h2 className="raw-heading">Raw JSON</h2>
<textarea
value={!isAllRecordsSelected && hasSelectedRecord ? recordJsonDraft : jsonText}
onChange={(event) => onRawJsonEditorChange(event.target.value)}
spellCheck={false}
aria-label="JSON editor"
className="json-editor"
/>
</>
);
}