Skip to content

Commit

Permalink
Slightly improve map interface
Browse files Browse the repository at this point in the history
davenquinn committed Nov 24, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
addaleax Anna Henningsen
1 parent d7e8261 commit 4dad3c0
Showing 2 changed files with 22 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/map-interface/src/context-panel/index.ts
Original file line number Diff line number Diff line change
@@ -37,13 +37,13 @@ type AnyChildren = React.ReactNode;

export interface FloatingNavbarProps {
className?: string;
children: AnyChildren;
children?: AnyChildren;
headerElement?: AnyChildren;
title?: AnyChildren;
statusElement?: AnyChildren;
rightElement?: AnyChildren;
height: number | string;
width: number | string;
height?: number | string;
width?: number | string;
style?: object;
}

23 changes: 19 additions & 4 deletions packages/map-interface/src/dev/map-page.ts
Original file line number Diff line number Diff line change
@@ -21,14 +21,15 @@ import { MapPosition } from "@macrostrat/mapbox-utils";

export const h = hyper.styled(styles);

export function MapInspector({
export function MapInspectorV2({
title = "Map inspector",
headerElement = null,
transformRequest = null,
mapPosition = null,
mapboxToken = null,
overlayStyle = null,
children,
controls = null,
children = null,
style,
bounds = null,
focusedSource = null,
@@ -40,6 +41,7 @@ export function MapInspector({
transformRequest?: mapboxgl.TransformRequestFunction;
title?: string;
style?: mapboxgl.Style | string;
controls?: React.ReactNode;
children?: React.ReactNode;
mapboxToken?: string;
overlayStyle?: mapboxgl.Style | string;
@@ -49,7 +51,7 @@ export function MapInspector({
mapPosition?: MapPosition;
bounds?: [number, number, number, number];
fitViewport?: boolean;
styleType: "standard" | "macrostrat";
styleType?: "standard" | "macrostrat";
}) {
/* We apply a custom style to the panel container when we are interacting
with the search bar, so that we can block map interactions until search
@@ -147,7 +149,7 @@ export function MapInspector({
title,
}),
contextPanel: h(PanelCard, [
children,
controls,
h(Switch, {
checked: xRay,
label: "X-ray mode",
@@ -180,10 +182,23 @@ export function MapInspector({
setPosition: onSelectPosition,
}),
h(TileExtentLayer, { tile, color: isEnabled ? "white" : "black" }),
children,
]
)
);
}

function MapInspector(props) {
const { children, controls, ...rest } = props;
/** Compatibility wrapper for MapInspectorV2 */
// React warning about this legacy usage
console.warn("MapInspector is deprecated. Use MapInspectorV2 instead");

return h(MapInspectorV2, {
...rest,
controls: [children, controls],
});
}

// Legacy export
export const DevMapPage = MapInspector;

0 comments on commit 4dad3c0

Please sign in to comment.