Skip to content

Commit 35e2501

Browse files
Merge pull request #2 from Chia-Chi-Shen/storybook
refine mapStyle sample codes
2 parents 0e3b5a4 + 2367e24 commit 35e2501

File tree

6 files changed

+62
-103
lines changed

6 files changed

+62
-103
lines changed

src/Test.tsx

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/stories/BasicUsage/MapStyles/MapStyles.stories.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import type { Meta, StoryObj } from '@storybook/react';
22
import MapStyles from './MapStyles';
3-
import { source } from 'azure-maps-control';
43

54
const meta: Meta<typeof MapStyles> = {
65
title: 'Basic Usage/Map Styles',
76
component: MapStyles,
87
parameters: {
98
layout: 'centered',
10-
source: `
9+
storySource: {
10+
source: `
1111
import { AzureMap, AzureMapsProvider } from 'react-azure-maps';
1212
1313
const MapStyles = () => {
14+
1415
return (
1516
<AzureMapsProvider>
1617
<div className="defaultMap">
@@ -27,6 +28,7 @@ const MapStyles = () => {
2728
);
2829
};
2930
`,
31+
},
3032
},
3133
};
3234
export default meta;

src/stories/DataVisualization/LineLayer/LineLayer.stories.ts

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,48 @@
11
import type { Meta, StoryObj } from '@storybook/react';
22
import LineLayer from './LineLayer';
3-
import { code } from './code';
43

54
const meta: Meta<typeof LineLayer> = {
65
title: 'Data Visualization/Line Layer',
76
component: LineLayer,
87
parameters: {
98
layout: 'centered',
109
storySource: {
11-
source: code,
10+
source: `
11+
import { AzureMap, AzureMapsProvider, AzureMapDataSourceProvider, AzureMapLayerProvider } from 'react-azure-maps';
12+
import atlas from 'azure-maps-control';
13+
14+
// create a line string for the data source
15+
const collection = new atlas.data.LineString([
16+
[-74.0039, 40.88029],
17+
[-87.583, 41.93497],
18+
[-105.20507, 39.77476],
19+
[-122.43164, 47.66538],
20+
]);
21+
22+
const LineLayer = () => {
23+
return (
24+
<AzureMapsProvider>
25+
<div className="defaultMap">
26+
<AzureMap options={your_options}>
27+
<AzureMapDataSourceProvider id="LineLayer DataSourceProvider" collection={collection}>
28+
<AzureMapLayerProvider
29+
type="LineLayer"
30+
options={{
31+
strokeColor,
32+
strokeWidth,
33+
strokeOpacity,
34+
blur,
35+
lineCap,
36+
translate,
37+
}}
38+
/>
39+
</AzureMapDataSourceProvider>
40+
</AzureMap>
41+
</div>
42+
</AzureMapsProvider>
43+
);
44+
};
45+
`,
1246
},
1347
},
1448
args: {

src/stories/DataVisualization/LineLayer/code.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/stories/MapAnnotations/HtmlMarker/HtmlMarker.stories.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Meta, StoryObj } from '@storybook/react';
22
import HtmlMarker from './HtmlMarker';
3-
import { code } from './code';
43

54
const meta: Meta<typeof HtmlMarker> = {
65
title: 'Map Annotations/HTML Marker',
@@ -13,7 +12,28 @@ const meta: Meta<typeof HtmlMarker> = {
1312
parameters: {
1413
layout: 'centered',
1514
storySource: {
16-
source: code,
15+
source: `
16+
import { AzureMap, AzureMapHtmlMarker, AzureMapsProvider } from 'react-azure-maps';
17+
import { HtmlMarkerOptions, SymbolLayerOptions } from 'azure-maps-control';
18+
19+
const HtmlMarker = () => {
20+
return (
21+
<AzureMapsProvider>
22+
<div className="defaultMap">
23+
<AzureMap options={your_options}>
24+
<AzureMapHtmlMarker
25+
options={{
26+
color: 'DodgerBlue',
27+
text: '10',
28+
position: [0, 0],
29+
}}
30+
/>
31+
</AzureMap>
32+
</div>
33+
</AzureMapsProvider>
34+
);
35+
};
36+
`,
1737
},
1838
},
1939
};

src/stories/MapAnnotations/HtmlMarker/code.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)