Skip to content

Commit

Permalink
CDC #35 - Adding comments to MapDraw props and component
Browse files Browse the repository at this point in the history
  • Loading branch information
dleadbetter committed Nov 9, 2023
1 parent 38ced3b commit 7e0a236
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/geospatial/src/components/MapDraw.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,33 @@ import DrawControl from './DrawControl';
import './MapDraw.css';

type Props = {
/**
* GeoJSON structured data to be displayed on the map.
*/
data: GeometryCollection | FeatureCollection,

/**
* URL of the map style to render. This URL should contain any necessary API keys.
*/
mapStyle: string,

/**
* Callback fired when the map geometries are changed.
*
* @param features
*/
onChange: (features: Array<any>) => void,

/**
* Map style object.
*/
style?: any
};

/**
* This component renders a map with controls for drawing one or more geometries. Geometries can be a point (lat/long),
* a line, or a polygon.
*/
const MapDraw = (props: Props) => {
const drawRef = useRef<MapboxDraw>();
const mapRef = useRef<MapRef>();
Expand Down
3 changes: 3 additions & 0 deletions packages/storybook/src/geospatial/MapDraw.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ export const Default = () => (
<MapDraw
mapStyle={`https://api.maptiler.com/maps/basic-v2/style.json?key=${process.env.REACT_APP_MAP_TILER_KEY}`}
onChange={action('onChange')}
style={{
marginBottom: '2em'
}}
/>
);

0 comments on commit 7e0a236

Please sign in to comment.