diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bedd0d0..567bc7de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Upgrade OpenLayers from v6 to v10 - When loading a style into localStorage that causes a QuotaExceededError, purge localStorage and retry - Remove react-autobind dependency +- Remove usage of legacy `childContextTypes` API - _...Add new stuff here..._ ### 🐞 Bug fixes diff --git a/src/components/AppLayout.tsx b/src/components/AppLayout.tsx index 1c8428a9..784abbcd 100644 --- a/src/components/AppLayout.tsx +++ b/src/components/AppLayout.tsx @@ -1,7 +1,7 @@ import React from 'react' -import PropTypes from 'prop-types' import ScrollContainer from './ScrollContainer' import { WithTranslation, withTranslation } from 'react-i18next'; +import { IconContext } from 'react-icons'; type AppLayoutInternalProps = { toolbar: React.ReactElement @@ -13,38 +13,31 @@ type AppLayoutInternalProps = { } & WithTranslation; class AppLayoutInternal extends React.Component { - static childContextTypes = { - reactIconBase: PropTypes.object - } - - getChildContext() { - return { - reactIconBase: { size: 14 } - } - } render() { document.body.dir = this.props.i18n.dir(); - return
- {this.props.toolbar} -
-
- {this.props.layerList} + return +
+ {this.props.toolbar} +
+
+ {this.props.layerList} +
+
+ + {this.props.layerEditor} + +
+ {this.props.map}
-
- - {this.props.layerEditor} - + {this.props.bottom &&
+ {this.props.bottom}
- {this.props.map} + } + {this.props.modals}
- {this.props.bottom &&
- {this.props.bottom} -
- } - {this.props.modals} -
+
} } diff --git a/src/components/LayerEditor.tsx b/src/components/LayerEditor.tsx index f1eff337..87560ee6 100644 --- a/src/components/LayerEditor.tsx +++ b/src/components/LayerEditor.tsx @@ -1,8 +1,8 @@ import React, {type JSX} from 'react' -import PropTypes from 'prop-types' import { Wrapper, Button, Menu, MenuItem } from 'react-aria-menubutton' import {Accordion} from 'react-accessible-accordion'; import {MdMoreVert} from 'react-icons/md' +import { IconContext } from 'react-icons' import {BackgroundLayerSpecification, LayerSpecification, SourceSpecification} from 'maplibre-gl'; import FieldJson from './FieldJson' @@ -86,10 +86,6 @@ class LayerEditorInternal extends React.Component {}, } - static childContextTypes = { - reactIconBase: PropTypes.object - } - constructor(props: LayerEditorInternalProps) { super(props) @@ -116,14 +112,6 @@ class LayerEditorInternal extends React.Component -
-
-

- {t("Layer: {{layerId}}", { layerId: formatLayerId(this.props.layer.id) })} -

-
- - - -
    - {Object.keys(items).map((id) => { - const item = items[id]; - return
  • - - {item.text} - -
  • - })} -
-
-
-
-
- -
- +
- {groups} - -
+
+
+

+ {t("Layer: {{layerId}}", { layerId: formatLayerId(this.props.layer.id) })} +

+
+ + + +
    + {Object.keys(items).map((id) => { + const item = items[id]; + return
  • + + {item.text} + +
  • + })} +
+
+
+
+
+ +
+ + {groups} + + + } } diff --git a/src/components/LayerListItem.tsx b/src/components/LayerListItem.tsx index 254900d5..04f16c77 100644 --- a/src/components/LayerListItem.tsx +++ b/src/components/LayerListItem.tsx @@ -1,8 +1,8 @@ import React from 'react' -import PropTypes from 'prop-types' import classnames from 'classnames' import {MdContentCopy, MdVisibility, MdVisibilityOff, MdDelete} from 'react-icons/md' +import { IconContext } from 'react-icons' import IconLayer from './IconLayer' import {SortableElement, SortableHandle} from 'react-sortable-hoc' @@ -91,51 +91,43 @@ class LayerListItem extends React.Component { onLayerVisibilityToggle: () => {}, } - static childContextTypes = { - reactIconBase: PropTypes.object - } - - getChildContext() { - return { - reactIconBase: { size: 14 } - } - } - render() { const visibilityAction = this.props.visibility === 'visible' ? 'show' : 'hide'; - return
  • this.props.onLayerSelect(this.props.layerIndex)} - data-wd-key={"layer-list-item:"+this.props.layerId} - className={classnames({ - "maputnik-layer-list-item": true, - "maputnik-layer-list-item-selected": this.props.isSelected, - [this.props.className!]: true, - })}> - - - this.props.onLayerDestroy!(this.props.layerIndex)} - /> - this.props.onLayerCopy!(this.props.layerIndex)} - /> - this.props.onLayerVisibilityToggle!(this.props.layerIndex)} - /> -
  • + return +
  • this.props.onLayerSelect(this.props.layerIndex)} + data-wd-key={"layer-list-item:"+this.props.layerId} + className={classnames({ + "maputnik-layer-list-item": true, + "maputnik-layer-list-item-selected": this.props.isSelected, + [this.props.className!]: true, + })}> + + + this.props.onLayerDestroy!(this.props.layerIndex)} + /> + this.props.onLayerCopy!(this.props.layerIndex)} + /> + this.props.onLayerVisibilityToggle!(this.props.layerIndex)} + /> +
  • +
    } }