mirror of
https://github.com/maputnik/editor.git
synced 2026-07-25 07:17:26 +00:00
9c1499b805
## Launch Checklist See title, Also removed some "_" from some file names. This is a pure refactoring, no logic changes. - [x] Briefly describe the changes in this PR. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
28 lines
944 B
TypeScript
28 lines
944 B
TypeScript
import { InputJson } from "./InputJson";
|
|
import React from "react";
|
|
import { withTranslation, type WithTranslation } from "react-i18next";
|
|
import { type StyleSpecification } from "maplibre-gl";
|
|
import { type StyleSpecificationWithId } from "../libs/definitions";
|
|
|
|
export type CodeEditorProps = {
|
|
value: StyleSpecification;
|
|
onChange: (value: StyleSpecificationWithId) => void;
|
|
onClose: () => void;
|
|
} & WithTranslation;
|
|
|
|
const CodeEditorInternal: React.FC<CodeEditorProps> = (props) => {
|
|
|
|
return <>
|
|
<button className="maputnik-button" onClick={props.onClose} aria-label={props.t("Close")} style={{ position: "sticky", top: "0", zIndex: 1 }}>{props.t("Click to close the editor")}</button>
|
|
<InputJson
|
|
lintType="style"
|
|
value={props.value}
|
|
onChange={props.onChange}
|
|
className={"maputnik-code-editor"}
|
|
withScroll={true}
|
|
/>;
|
|
</>;
|
|
};
|
|
|
|
export const CodeEditor = withTranslation()(CodeEditorInternal);
|