Skip to content

Commit

Permalink
refactor: 调整 withAMap 的实现方式
Browse files Browse the repository at this point in the history
  • Loading branch information
xyy94813 committed Nov 11, 2023
1 parent de4c4da commit 36beca2
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/components/AMapCircle/stories/AMapCircle.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
title: '组件(Components)/覆盖物(Overlay)/AMapCircle',
decorators: [
withAutoFitView,
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
title: '组件(Components)/地图控件(Control)/AMapControlBar',
component: AMapControlBar,
decorators: [
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
2 changes: 1 addition & 1 deletion src/components/AMapEllipse/stories/AMapEllipse.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
title: '组件(Components)/覆盖物(Overlay)/AMapEllipse',
decorators: [
withAutoFitView,
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
2 changes: 1 addition & 1 deletion src/components/AMapGeoJSON/stories/AMapGeoJSON.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default {
title: '组件(Components)/覆盖物(Overlay)/AMapGeoJSON',
decorators: [
withAutoFitView,
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
2 changes: 1 addition & 1 deletion src/components/AMapHawkEye/stories/AMapHawkEye.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
title: '组件(Components)/地图控件(Control)/AMapHawkEye',
component: AMapHawkEye,
decorators: [
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
2 changes: 1 addition & 1 deletion src/components/AMapMapType/stories/AMapMapType.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
title: '组件(Components)/地图控件(Control)/AMapMapType',
component: AMapMapType,
decorators: [
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
2 changes: 1 addition & 1 deletion src/components/AMapMarker/stories/AMapMarker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
component: AMapMarker,
decorators: [
withAutoFitView,
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const eventHandler = actions('onCompleted');
export default {
title: '组件(Components)/工具(Tools)/AMapMouseTool',
decorators: [
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {
title: '组件(Components)/覆盖物(Overlay)/AMapOverlayGroup',
decorators: [
withAutoFitView,
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
2 changes: 1 addition & 1 deletion src/components/AMapPolygon/stories/AMapPolygon.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
title: '组件(Components)/覆盖物(Overlay)/AMapPolygon',
decorators: [
withAutoFitView,
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default {
title: '组件(Components)/工具(Tools)/AMapPolygonEditor',
decorators: [
withAutoFitView,
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default {
title: '组件(Components)/覆盖物(Overlay)/AMapPolyline',
decorators: [
withAutoFitView,
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
title: '组件(Components)/工具(Tools)/AMapPolylineEditor',
decorators: [
withAutoFitView,
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
2 changes: 1 addition & 1 deletion src/components/AMapScale/stories/AMapScale.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
title: '组件(Components)/地图控件(Control)/AMapScale',
component: AMapScale,
decorators: [
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
2 changes: 1 addition & 1 deletion src/components/AMapToolBar/stories/AMapToolBar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
title: '组件(Components)/地图控件(Control)/AMapToolBar',
component: AMapToolBar,
decorators: [
withAMap,
withAMap(),
withAMapContainer,
withAPIContainer,
],
Expand Down
7 changes: 4 additions & 3 deletions src/storybook-decorators/withAMap.tsx
Original file line number Diff line number Diff line change
@@ -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) => (
<AMapMap>{renderStory({}, context)}</AMapMap>
const withAMap = (mapProps: AMapMapProps = {}) => (renderStory: Story, context: any) => (
// eslint-disable-next-line react/jsx-props-no-spreading
<AMapMap {...mapProps}>{renderStory({}, context)}</AMapMap>
);

export default withAMap;

0 comments on commit 36beca2

Please sign in to comment.