Repository navigation
Support controlled tabs for embedded map details #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
krowvin
wants to merge
3
commits into
main
Choose a base branch
from
mapping/swt-map-replacement
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
src/app-pages/documentation/mapping/status-marker-layer.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| import { UsaceBox, Code, Text } from "../../../../lib"; | ||
| import { CodeExample } from "../../../app-components/code-example"; | ||
| import PropsTable from "../../../app-components/props-table"; | ||
| import DocsPage from "../_docs-page"; | ||
|
|
||
| const BASE_URL = import.meta.env.BASE_URL; | ||
|
|
||
| const pageBreadcrumbs = [ | ||
| { | ||
| text: "Documentation", | ||
| href: `${BASE_URL}#/docs`, | ||
| }, | ||
| { | ||
| text: "Mapping", | ||
| href: `${BASE_URL}#/docs/mapping`, | ||
| }, | ||
| { | ||
| text: "Status Marker Layer", | ||
| href: `${BASE_URL}#/docs/mapping/status-marker-layer`, | ||
| }, | ||
| ]; | ||
|
|
||
| const componentProps = [ | ||
| { | ||
| name: "source", | ||
| type: "array or GeoJSON FeatureCollection", | ||
| default: "[]", | ||
| desc: "Point records to render. GeoJSON coordinates must be longitude, latitude.", | ||
| }, | ||
| { | ||
| name: "statusAccessor", | ||
| type: "function", | ||
| default: "threshold status from statusValue or value", | ||
| desc: "Returns the status bucket used to choose the marker color. Use a numeric bucket, missing, or transparent.", | ||
| }, | ||
| { | ||
| name: "shapeAccessor", | ||
| type: "function", | ||
| default: "reservoir/project triangle, lock square, other diamond", | ||
| desc: "Returns circle, triangle, square, or diamond for each marker.", | ||
| }, | ||
| { | ||
| name: "labelAccessor", | ||
| type: "function", | ||
| default: "mapLabel, publicName, name, or id", | ||
| desc: "Returns the text label drawn above the marker.", | ||
| }, | ||
| { | ||
| name: "fit", | ||
| type: "boolean", | ||
| default: "false", | ||
| desc: "Fits the map view to the marker extent after the layer is added.", | ||
| }, | ||
| { | ||
| name: "onClick", | ||
| type: "function", | ||
| default: "undefined", | ||
| desc: "Receives the clicked OpenLayers feature and map coordinate.", | ||
| }, | ||
| ]; | ||
|
|
||
| function StatusMarkerLayerDocs() { | ||
| return ( | ||
| <DocsPage breadcrumbs={pageBreadcrumbs}> | ||
| <UsaceBox title="Status Marker Layer"> | ||
| <Text className="gw-pb-6"> | ||
| StatusMarkerLayer renders point datasets with configurable status | ||
| colors, marker shapes, labels, and click handling. It is intended for | ||
| office-neutral status maps where the application owns the data query | ||
| and domain-specific grouping. | ||
| </Text> | ||
| <CodeExample | ||
| code={`import { | ||
| getThresholdStatus, | ||
| Map, | ||
| MapLayout, | ||
| StatusLegend, | ||
| StatusMarkerLayer | ||
| } from "@usace/groundwork-geo"; | ||
|
|
||
| const locations = { | ||
| type: "FeatureCollection", | ||
| features: [ | ||
| { | ||
| type: "Feature", | ||
| geometry: { type: "Point", coordinates: [-95.8, 35.3] }, | ||
| properties: { | ||
| name: "Example.Project", | ||
| publicName: "Example Project", | ||
| locationType: "reservoir", | ||
| statusValue: 62 | ||
| } | ||
| } | ||
| ] | ||
| }; | ||
|
|
||
| const layers = [ | ||
| new StatusMarkerLayer({ | ||
| id: "project-status", | ||
| name: "Project Status", | ||
| source: locations, | ||
| fit: true, | ||
| statusAccessor: (location) => | ||
| location.statusValue == null | ||
| ? "missing" | ||
| : getThresholdStatus(location.statusValue), | ||
| onClick: (feature) => console.log(feature.getProperties()) | ||
| }) | ||
| ]; | ||
|
|
||
| function Component() { | ||
| return ( | ||
| <div> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure to wrap this in an absolute height so that the map will render |
||
| <MapLayout> | ||
| <Map mapId="status-map" layers={layers} /> | ||
| </MapLayout> | ||
| <StatusLegend title="Percent Full/Flow" /> | ||
| </div> | ||
| ); | ||
| }`} | ||
| /> | ||
| <div className="gw-font-bold gw-text-lg gw-pt-6"> | ||
| Class API - <Code className="gw-p-2">{`StatusMarkerLayer`}</Code> | ||
| </div> | ||
| <PropsTable propsList={componentProps} /> | ||
| </UsaceBox> | ||
| </DocsPage> | ||
| ); | ||
| } | ||
|
|
||
| export default StatusMarkerLayerDocs; | ||
| export { StatusMarkerLayerDocs }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably forward onChange even if a tab is not selected. That way any future improvements can use it.