icons added
This commit is contained in:
parent
18c1cf0b25
commit
d8e9b74988
@ -1,7 +1,7 @@
|
|||||||
import React, { createRef, useContext } from "react";
|
import React, { createRef, useContext } from "react";
|
||||||
import Stack from "react-bootstrap/Stack";
|
import Stack from "react-bootstrap/Stack";
|
||||||
import { MapContainer, GeoJSON, Marker, Tooltip } from "react-leaflet";
|
import { MapContainer, GeoJSON, Marker, Tooltip } from "react-leaflet";
|
||||||
import L from "leaflet";
|
import L, { icon } from "leaflet";
|
||||||
import Africa from "../../../Data/ControlinAfrica.geojson";
|
import Africa from "../../../Data/ControlinAfrica.geojson";
|
||||||
import "../../../Styles/main.scss";
|
import "../../../Styles/main.scss";
|
||||||
import { CountryStyle, CountrySelectedStyle } from "./countryStyles";
|
import { CountryStyle, CountrySelectedStyle } from "./countryStyles";
|
||||||
@ -67,6 +67,7 @@ class ControlInAfricaMap extends React.Component {
|
|||||||
selectedCountriesIntersections: [],
|
selectedCountriesIntersections: [],
|
||||||
|
|
||||||
selectedCountryColor: "yellow",
|
selectedCountryColor: "yellow",
|
||||||
|
selectedIcon: "none",
|
||||||
|
|
||||||
prevStatuesRegion: "",
|
prevStatuesRegion: "",
|
||||||
prevStatuesTreaty: "",
|
prevStatuesTreaty: "",
|
||||||
@ -160,14 +161,20 @@ class ControlInAfricaMap extends React.Component {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
intsruments = [
|
intsruments = [
|
||||||
{ name2: "UNProgrammeofAction", name: "UN Programme of Action" },
|
{
|
||||||
|
name2: "UNProgrammeofAction",
|
||||||
|
name: "UN Programme of Action",
|
||||||
|
icon: Icon16,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name2: "InternationalTracingInstrument",
|
name2: "InternationalTracingInstrument",
|
||||||
name: "International Tracing Instrument",
|
name: "International Tracing Instrument",
|
||||||
|
icon: Icon1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name2: "StG-PoA",
|
name2: "StG-PoA",
|
||||||
name: "Silencing the Guns in Africa Programme of Action",
|
name: "Silencing the Guns in Africa Programme of Action",
|
||||||
|
icon: Icon20,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -373,14 +380,30 @@ class ControlInAfricaMap extends React.Component {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
handleTreatiesClick = (name, status, color) => {
|
handleTreatiesClick = (name, status) => {
|
||||||
const {
|
const {
|
||||||
selectedRegion,
|
selectedRegion,
|
||||||
selectedTreaty,
|
selectedTreaty,
|
||||||
selectedCountriesNamesRegions,
|
selectedCountriesNamesRegions,
|
||||||
prevStatuesTreaty,
|
prevStatuesTreaty,
|
||||||
africaCountries,
|
africaCountries,
|
||||||
|
selectedIcon,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
|
// get the icon of the selected treaty based on the name and status of the treaty
|
||||||
|
console.log(name, status);
|
||||||
|
|
||||||
|
let org =
|
||||||
|
this.regional_treaties.find((org) => org.name2 === name) ||
|
||||||
|
this.international_treaties.find((org) => org.name2 === name);
|
||||||
|
|
||||||
|
if (org) {
|
||||||
|
//console.log(org[`icon_${status.toLowerCase()}`]);
|
||||||
|
this.setState({
|
||||||
|
selectedIcon: org[`icon_${status.toLowerCase()}`] || "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// if the same treaty is selected previously and the region is not selected
|
// if the same treaty is selected previously and the region is not selected
|
||||||
// then the treaty will be deselected
|
// then the treaty will be deselected
|
||||||
if (
|
if (
|
||||||
@ -397,6 +420,7 @@ class ControlInAfricaMap extends React.Component {
|
|||||||
selectedTreaty: "",
|
selectedTreaty: "",
|
||||||
prevStatuesTreaty: "",
|
prevStatuesTreaty: "",
|
||||||
prevStatuesRegion: "",
|
prevStatuesRegion: "",
|
||||||
|
selectedIcon: "none",
|
||||||
showInfoBox: false,
|
showInfoBox: false,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@ -411,6 +435,7 @@ class ControlInAfricaMap extends React.Component {
|
|||||||
selectedCountry: "",
|
selectedCountry: "",
|
||||||
selectedTreaty: "",
|
selectedTreaty: "",
|
||||||
prevStatuesTreaty: "",
|
prevStatuesTreaty: "",
|
||||||
|
selectedIcon: "none",
|
||||||
showInfoBox: true,
|
showInfoBox: true,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@ -436,7 +461,6 @@ class ControlInAfricaMap extends React.Component {
|
|||||||
);
|
);
|
||||||
this.setState({
|
this.setState({
|
||||||
selectedCountriesNamesTreaties: intersection,
|
selectedCountriesNamesTreaties: intersection,
|
||||||
//selectedCountryColor: "yellow",
|
|
||||||
selectedCountry: "",
|
selectedCountry: "",
|
||||||
selectedTreaty: name,
|
selectedTreaty: name,
|
||||||
prevStatuesTreaty: status,
|
prevStatuesTreaty: status,
|
||||||
@ -576,6 +600,7 @@ class ControlInAfricaMap extends React.Component {
|
|||||||
selectedCountryColor,
|
selectedCountryColor,
|
||||||
selectedRegion,
|
selectedRegion,
|
||||||
selectedTreaty,
|
selectedTreaty,
|
||||||
|
selectedIcon,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
@ -912,7 +937,7 @@ class ControlInAfricaMap extends React.Component {
|
|||||||
feature.properties.y,
|
feature.properties.y,
|
||||||
feature.properties.x,
|
feature.properties.x,
|
||||||
]}
|
]}
|
||||||
icon={Icon20}
|
icon={selectedIcon}
|
||||||
></MarkerIcon>
|
></MarkerIcon>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import Icon25 from "../../../Icons/icon25.svg";
|
|||||||
import Icon26 from "../../../Icons/icon26.svg";
|
import Icon26 from "../../../Icons/icon26.svg";
|
||||||
|
|
||||||
const MarkerIcon = (props) => {
|
const MarkerIcon = (props) => {
|
||||||
|
console.log(props.icon)
|
||||||
return (
|
return (
|
||||||
<Marker
|
<Marker
|
||||||
key={props.index}
|
key={props.index}
|
||||||
|
Loading…
Reference in New Issue
Block a user