Skip to content

Commit

Permalink
Slightly improve map interface
Browse files Browse the repository at this point in the history
  • Loading branch information
davenquinn committed Nov 24, 2024
1 parent d7e8261 commit 4dad3c0
Show file tree
Hide file tree
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
Expand Up @@ -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;
}

Expand Down
23 changes: 19 additions & 4 deletions packages/map-interface/src/dev/map-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -147,7 +149,7 @@ export function MapInspector({
title,
}),
contextPanel: h(PanelCard, [
children,
controls,
h(Switch, {
checked: xRay,
label: "X-ray mode",
Expand Down Expand Up @@ -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.