Skip to content

Commit 82c8e49

Browse files
committed
#14 - Added map control documentation
1 parent eef2eaf commit 82c8e49

File tree

5 files changed

+67
-5
lines changed

5 files changed

+67
-5
lines changed
2.49 MB
Loading
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Map control
2+
3+
This control renders can be used to render a map in your solution. The control has also the ability to search for new locations.
4+
5+
Here is an example of the control in action:
6+
7+
![Map control](../assets/map-control.gif)
8+
9+
## How to use this control in your solutions
10+
11+
- Check that you installed the `@pnp/spfx-controls-react` dependency. Check out the [getting started](../#getting-started) page for more information about installing the dependency.
12+
- In your component file, import the `Map` control as follows:
13+
14+
```TypeScript
15+
import { Map, ICoordinates, MapType } from "@pnp/spfx-controls-react/lib/Map";
16+
```
17+
18+
- Use the `Map` control in your code as follows:
19+
20+
```TypeScript
21+
<Map titleText="New of London"
22+
coordinates={{ latitude: 51.507351, longitude: -0.127758 }}
23+
enableSearch={true} />
24+
```
25+
26+
## Implementation
27+
28+
The `Map` control can be configured with the following properties:
29+
30+
| Property | Type | Required | Description | Default |
31+
| ---- | ---- | ---- | ---- | ---- |
32+
| titleText | string | no | Title label to show above the control. | |
33+
| coordinates | ICoordinates | yes | Coordinates required for rendering the control. | |
34+
| enableSearch | boolean | no | Allow the user to search for new locations. | |
35+
| zoom | number | no | Zoom level for the maps on display (range 1-15). | 10 |
36+
| width | number | no | Width of the maps area in percentage. | 100% |
37+
| height | number | no | Height of the maps area. | 300px |
38+
| mapType | MapType | no | Type of the map to render. | standard |
39+
| loadingMessage | string | no | Custom loading message. | |
40+
| errorMessage | string | no | Custom error message. | |
41+
| mapsClassName | string | no | Custom CSS class name. | |
42+
| errorMessageClassName | string | no | Custom CSS error class name. | |
43+
44+
`ICoordinates` interface:
45+
46+
| Property | Type | Required | Description | Default |
47+
| ---- | ---- | ---- | ---- | ---- |
48+
| latitude | number | yes | Latitude of the map to display. | |
49+
| longitude | number | yes | Longitude of the map to display. | |
50+
51+
`MapType` enum:
52+
53+
| Name |
54+
| ---- |
55+
| standard |
56+
| cycle |
57+
| normal |
58+
| transport |
59+
60+
61+
![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/Map)

docs/documentation/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ nav:
77
- ListPicker: 'controls/ListPicker.md'
88
- ListView: 'controls/ListView.md'
99
- "ListView: add a contextual menu": 'controls/ListView.ContextualMenu.md'
10+
- Map: 'controls/Map.md'
1011
- Placeholder: 'controls/Placeholder.md'
1112
- SiteBreadcrumb: 'controls/SiteBreadcrumb.md'
1213
- WebPartTitle: 'controls/WebPartTitle.md'

src/controls/map/IMapProps.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export interface IMapProps {
66
*/
77
titleText?: string;
88
/**
9-
* Corodinates required of the Control
10-
*/
9+
* Coordinates required for rendering the control
10+
*/
1111
coordinates: ICoordinates;
1212
/**
1313
* Show search box - which means an API key is needed

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
233233
title={this.props.title}
234234
updateProperty={this.props.updateProperty} />
235235

236-
<Map titleText="Map of London"
236+
<Map titleText="New map control"
237237
coordinates={{ latitude: 51.507351, longitude: -0.127758 }}
238238
enableSearch={true}
239-
mapType={MapType.cycle}
240-
zoom={15}
239+
mapType={MapType.normal}
240+
// zoom={15}
241241
//mapType={MapType.cycle}
242242
//width="50"
243243
//height={150}

0 commit comments

Comments
 (0)