Reorganize React project structure.

Whatever I was doing was getting out of control :)
This commit is contained in:
Dan Albert
2022-03-01 00:48:08 -08:00
parent 406a64ae3f
commit 6ff9208d46
19 changed files with 67 additions and 66 deletions

View File

@@ -0,0 +1,32 @@
import { Icon, Point } from "leaflet";
import { Marker, Popup } from "react-leaflet";
import { ControlPoint as ControlPointModel } from "../../api/controlpoint";
import { Symbol as MilSymbol } from "milsymbol";
function iconForControlPoint(cp: ControlPointModel) {
const symbol = new MilSymbol(cp.sidc, {
size: 24,
colorMode: "Dark",
});
return new Icon({
iconUrl: symbol.toDataURL(),
iconAnchor: new Point(symbol.getAnchor().x, symbol.getAnchor().y),
});
}
interface ControlPointProps {
controlPoint: ControlPointModel;
}
export default function ControlPoint(props: ControlPointProps) {
return (
<Marker
position={props.controlPoint.position}
icon={iconForControlPoint(props.controlPoint)}
>
<Popup>{props.controlPoint.name}</Popup>
</Marker>
);
}

View File

@@ -0,0 +1 @@
export { default } from "./ControlPoint";