Skip to content

Commit

Permalink
docs: add example
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxingkang committed Jan 19, 2024
1 parent c984afd commit dd18c92
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions stories/examples/ClusterPro.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React, { useRef } from 'react';
import { Avatar } from 'antd';
import { Map, Marker, StyleLoadFinish, MarkerCluster } from '../../src';

import type { Meta, StoryObj } from '@storybook/react';
import type { Supercluster } from '../../src';

const meta = {
title: '示例/ClusterPro',
render: () => {
const clusterRef = useRef<Supercluster>(null);

return (
<Map
zoom={3}
center={[-103.5917, 40.6699]}
style="mapbox://styles/mapbox/dark-v11"
containerStyle={{ height: '100vh' }}
>
<StyleLoadFinish>
<MarkerCluster
cluster={{ radius: 50 }}
ref={clusterRef}
render={<Avatar style={{ backgroundColor: '#fde3cf', color: '#f56a00' }}>U</Avatar>}
renderCluster={(count) => {
return (
<Avatar size={54} style={{ backgroundColor: '#87d068' }}>
{count}
</Avatar>
);
}}
/>
</StyleLoadFinish>
</Map>
);
},
parameters: {
layout: 'fullscreen',
},
argTypes: {},
args: {
lngLat: [-122.414, 37.776],
},
} satisfies Meta<typeof Marker>;

export default meta;
type Story = StoryObj<typeof meta>;

export const ClusterPro: Story = {
args: {},
};

0 comments on commit dd18c92

Please sign in to comment.