From 36beca2230456f2eeaa968425d1e4e2c124dbe8e Mon Sep 17 00:00:00 2001 From: RoXoM Date: Sat, 11 Nov 2023 11:20:08 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4=20withAMap=20?= =?UTF-8?q?=E7=9A=84=E5=AE=9E=E7=8E=B0=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AMapCircle/stories/AMapCircle.stories.tsx | 2 +- .../AMapControlBar/stories/AMapControlBar.stories.tsx | 2 +- src/components/AMapEllipse/stories/AMapEllipse.stories.tsx | 2 +- src/components/AMapGeoJSON/stories/AMapGeoJSON.stories.tsx | 2 +- src/components/AMapHawkEye/stories/AMapHawkEye.stories.tsx | 2 +- src/components/AMapMapType/stories/AMapMapType.stories.tsx | 2 +- src/components/AMapMarker/stories/AMapMarker.stories.tsx | 2 +- .../AMapMouseTool/stories/AMapMouseTool.stories.tsx | 2 +- .../AMapOverlayGroup/stories/AMapOverlayGroup.stories.tsx | 2 +- src/components/AMapPolygon/stories/AMapPolygon.stories.tsx | 2 +- .../stories/AMapPolygonEditor.stories.tsx | 2 +- .../AMapPolyline/stories/AMapPolyline.stories.tsx | 2 +- .../stories/AMapPolylineEditor.stories.tsx | 2 +- src/components/AMapScale/stories/AMapScale.stories.tsx | 2 +- src/components/AMapToolBar/stories/AMapToolBar.stories.tsx | 2 +- src/storybook-decorators/withAMap.tsx | 7 ++++--- 16 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/components/AMapCircle/stories/AMapCircle.stories.tsx b/src/components/AMapCircle/stories/AMapCircle.stories.tsx index da69f13..4eca47b 100644 --- a/src/components/AMapCircle/stories/AMapCircle.stories.tsx +++ b/src/components/AMapCircle/stories/AMapCircle.stories.tsx @@ -28,7 +28,7 @@ export default { title: '组件(Components)/覆盖物(Overlay)/AMapCircle', decorators: [ withAutoFitView, - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapControlBar/stories/AMapControlBar.stories.tsx b/src/components/AMapControlBar/stories/AMapControlBar.stories.tsx index 6b22243..ee8250a 100644 --- a/src/components/AMapControlBar/stories/AMapControlBar.stories.tsx +++ b/src/components/AMapControlBar/stories/AMapControlBar.stories.tsx @@ -14,7 +14,7 @@ export default { title: '组件(Components)/地图控件(Control)/AMapControlBar', component: AMapControlBar, decorators: [ - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapEllipse/stories/AMapEllipse.stories.tsx b/src/components/AMapEllipse/stories/AMapEllipse.stories.tsx index 3d0e331..189f0ab 100644 --- a/src/components/AMapEllipse/stories/AMapEllipse.stories.tsx +++ b/src/components/AMapEllipse/stories/AMapEllipse.stories.tsx @@ -28,7 +28,7 @@ export default { title: '组件(Components)/覆盖物(Overlay)/AMapEllipse', decorators: [ withAutoFitView, - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapGeoJSON/stories/AMapGeoJSON.stories.tsx b/src/components/AMapGeoJSON/stories/AMapGeoJSON.stories.tsx index 3dfe98e..c86c611 100644 --- a/src/components/AMapGeoJSON/stories/AMapGeoJSON.stories.tsx +++ b/src/components/AMapGeoJSON/stories/AMapGeoJSON.stories.tsx @@ -102,7 +102,7 @@ export default { title: '组件(Components)/覆盖物(Overlay)/AMapGeoJSON', decorators: [ withAutoFitView, - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapHawkEye/stories/AMapHawkEye.stories.tsx b/src/components/AMapHawkEye/stories/AMapHawkEye.stories.tsx index 6382b36..3750c3e 100644 --- a/src/components/AMapHawkEye/stories/AMapHawkEye.stories.tsx +++ b/src/components/AMapHawkEye/stories/AMapHawkEye.stories.tsx @@ -14,7 +14,7 @@ export default { title: '组件(Components)/地图控件(Control)/AMapHawkEye', component: AMapHawkEye, decorators: [ - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapMapType/stories/AMapMapType.stories.tsx b/src/components/AMapMapType/stories/AMapMapType.stories.tsx index 548bce0..b103d68 100644 --- a/src/components/AMapMapType/stories/AMapMapType.stories.tsx +++ b/src/components/AMapMapType/stories/AMapMapType.stories.tsx @@ -14,7 +14,7 @@ export default { title: '组件(Components)/地图控件(Control)/AMapMapType', component: AMapMapType, decorators: [ - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapMarker/stories/AMapMarker.stories.tsx b/src/components/AMapMarker/stories/AMapMarker.stories.tsx index 36c45b0..bd1533f 100644 --- a/src/components/AMapMarker/stories/AMapMarker.stories.tsx +++ b/src/components/AMapMarker/stories/AMapMarker.stories.tsx @@ -41,7 +41,7 @@ export default { component: AMapMarker, decorators: [ withAutoFitView, - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapMouseTool/stories/AMapMouseTool.stories.tsx b/src/components/AMapMouseTool/stories/AMapMouseTool.stories.tsx index 25d6cce..5b0bb61 100644 --- a/src/components/AMapMouseTool/stories/AMapMouseTool.stories.tsx +++ b/src/components/AMapMouseTool/stories/AMapMouseTool.stories.tsx @@ -13,7 +13,7 @@ const eventHandler = actions('onCompleted'); export default { title: '组件(Components)/工具(Tools)/AMapMouseTool', decorators: [ - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapOverlayGroup/stories/AMapOverlayGroup.stories.tsx b/src/components/AMapOverlayGroup/stories/AMapOverlayGroup.stories.tsx index a70f1a8..21de593 100644 --- a/src/components/AMapOverlayGroup/stories/AMapOverlayGroup.stories.tsx +++ b/src/components/AMapOverlayGroup/stories/AMapOverlayGroup.stories.tsx @@ -35,7 +35,7 @@ export default { title: '组件(Components)/覆盖物(Overlay)/AMapOverlayGroup', decorators: [ withAutoFitView, - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapPolygon/stories/AMapPolygon.stories.tsx b/src/components/AMapPolygon/stories/AMapPolygon.stories.tsx index 923da90..6dc7196 100644 --- a/src/components/AMapPolygon/stories/AMapPolygon.stories.tsx +++ b/src/components/AMapPolygon/stories/AMapPolygon.stories.tsx @@ -38,7 +38,7 @@ export default { title: '组件(Components)/覆盖物(Overlay)/AMapPolygon', decorators: [ withAutoFitView, - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapPolygonEditor/stories/AMapPolygonEditor.stories.tsx b/src/components/AMapPolygonEditor/stories/AMapPolygonEditor.stories.tsx index 5f1340a..21e4aed 100644 --- a/src/components/AMapPolygonEditor/stories/AMapPolygonEditor.stories.tsx +++ b/src/components/AMapPolygonEditor/stories/AMapPolygonEditor.stories.tsx @@ -99,7 +99,7 @@ export default { title: '组件(Components)/工具(Tools)/AMapPolygonEditor', decorators: [ withAutoFitView, - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapPolyline/stories/AMapPolyline.stories.tsx b/src/components/AMapPolyline/stories/AMapPolyline.stories.tsx index 96e5f8d..7e477b7 100644 --- a/src/components/AMapPolyline/stories/AMapPolyline.stories.tsx +++ b/src/components/AMapPolyline/stories/AMapPolyline.stories.tsx @@ -36,7 +36,7 @@ export default { title: '组件(Components)/覆盖物(Overlay)/AMapPolyline', decorators: [ withAutoFitView, - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapPolylineEditor/stories/AMapPolylineEditor.stories.tsx b/src/components/AMapPolylineEditor/stories/AMapPolylineEditor.stories.tsx index 09241e0..069c6a9 100644 --- a/src/components/AMapPolylineEditor/stories/AMapPolylineEditor.stories.tsx +++ b/src/components/AMapPolylineEditor/stories/AMapPolylineEditor.stories.tsx @@ -41,7 +41,7 @@ export default { title: '组件(Components)/工具(Tools)/AMapPolylineEditor', decorators: [ withAutoFitView, - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapScale/stories/AMapScale.stories.tsx b/src/components/AMapScale/stories/AMapScale.stories.tsx index 2a00700..dd86de2 100644 --- a/src/components/AMapScale/stories/AMapScale.stories.tsx +++ b/src/components/AMapScale/stories/AMapScale.stories.tsx @@ -14,7 +14,7 @@ export default { title: '组件(Components)/地图控件(Control)/AMapScale', component: AMapScale, decorators: [ - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/components/AMapToolBar/stories/AMapToolBar.stories.tsx b/src/components/AMapToolBar/stories/AMapToolBar.stories.tsx index 07de30b..a72da7c 100644 --- a/src/components/AMapToolBar/stories/AMapToolBar.stories.tsx +++ b/src/components/AMapToolBar/stories/AMapToolBar.stories.tsx @@ -14,7 +14,7 @@ export default { title: '组件(Components)/地图控件(Control)/AMapToolBar', component: AMapToolBar, decorators: [ - withAMap, + withAMap(), withAMapContainer, withAPIContainer, ], diff --git a/src/storybook-decorators/withAMap.tsx b/src/storybook-decorators/withAMap.tsx index 040e7b1..83b0e47 100644 --- a/src/storybook-decorators/withAMap.tsx +++ b/src/storybook-decorators/withAMap.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; import type { Story } from '@storybook/react'; -import { AMapMap } from '../index'; +import { AMapMap, AMapMapProps } from '../index'; -const withAMap = (renderStory: Story, context: any) => ( - {renderStory({}, context)} +const withAMap = (mapProps: AMapMapProps = {}) => (renderStory: Story, context: any) => ( + // eslint-disable-next-line react/jsx-props-no-spreading + {renderStory({}, context)} ); export default withAMap;