mirror of
https://github.com/maputnik/editor.git
synced 2025-12-24 07:00:01 +00:00
## Launch Checklist This PR adds the ability to look at the entire style and edit it in a code editor that supports syntax highlight, errors, search and more. - Resolves #820 CC: @Kanahiro as I know you did something similar, probably has better performance... After: <img width="1920" height="937" alt="image" src="https://github.com/user-attachments/assets/f925cf92-2623-4390-8f75-14d7f6a79171" /> - [x] Briefly describe the changes in this PR. - [x] Link to related issues. - [x] Include before/after visuals or gifs if this PR includes visual changes. - [x] Write tests for all new functionality. - [x] Add an entry to `CHANGELOG.md` under the `## main` section. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Frank Elsinga <frank@elsinga.de>
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import React from "react";
|
|
import ScrollContainer from "./ScrollContainer";
|
|
import { type WithTranslation, withTranslation } from "react-i18next";
|
|
import { IconContext } from "react-icons";
|
|
|
|
type AppLayoutInternalProps = {
|
|
toolbar: React.ReactElement
|
|
layerList: React.ReactElement
|
|
layerEditor?: React.ReactElement
|
|
codeEditor?: React.ReactElement
|
|
map: React.ReactElement
|
|
bottom?: React.ReactElement
|
|
modals?: React.ReactNode
|
|
} & WithTranslation;
|
|
|
|
class AppLayoutInternal extends React.Component<AppLayoutInternalProps> {
|
|
|
|
render() {
|
|
document.body.dir = this.props.i18n.dir();
|
|
|
|
return <IconContext.Provider value={{size: "14px"}}>
|
|
<div className="maputnik-layout">
|
|
{this.props.toolbar}
|
|
<div className="maputnik-layout-main">
|
|
{this.props.codeEditor && <div className="maputnik-layout-code-editor">
|
|
<ScrollContainer>
|
|
{this.props.codeEditor}
|
|
</ScrollContainer>
|
|
</div>
|
|
}
|
|
{!this.props.codeEditor && <>
|
|
<div className="maputnik-layout-list">
|
|
{this.props.layerList}
|
|
</div>
|
|
<div className="maputnik-layout-drawer">
|
|
<ScrollContainer>
|
|
{this.props.layerEditor}
|
|
</ScrollContainer>
|
|
</div>
|
|
</>}
|
|
{this.props.map}
|
|
</div>
|
|
{this.props.bottom && <div className="maputnik-layout-bottom">
|
|
{this.props.bottom}
|
|
</div>
|
|
}
|
|
{this.props.modals}
|
|
</div>
|
|
</IconContext.Provider>;
|
|
}
|
|
}
|
|
|
|
const AppLayout = withTranslation()(AppLayoutInternal);
|
|
export default AppLayout;
|