Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion memory-bank/usage/map.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ graph TD
- `forceAspectRatio`: Optional boolean to force aspect ratio (16:9 for Desktop, 4:3 for Mobile), `true` by default (inherited from MapBaseProps)
- `disableControls`: Optional boolean to hide map controls (Yandex Maps only), `false` by default
- `disableBalloons`: Optional boolean to disable info balloons (Yandex Maps only), `false` by default
- `areaMargin:` - Optional offset (in pixels) for the marked area of the map relative to the map's container (`30` by default)
- `areaMargin:`: Optional offset (in pixels) for the marked area of the map relative to the map's container (`30` by default)
- `copyrightPosition`: Optional position of the copyright text (in pixels)

#### MapBaseProps (Common Props)

Expand Down
2 changes: 2 additions & 0 deletions src/components/Map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Map

`areaMargin?: number | [number, number] | [number, number, number]` - Offset (in pixels) for the marked area of the map relative to the map's container. Only for `Yandex maps`. `30` by default

`copyrightPosition?: { top?: number; right?: number; bottom?: number; left?: number }` - Position of the copyright text (in pixels). Only for `Yandex maps`

`markers?: object[]` - Description for placemarkers. You need to use it for `Yandex maps`. Specify the parameters given below.

- `address?: string` — Place name, address
Expand Down
3 changes: 3 additions & 0 deletions src/components/Map/YMap/YandexMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const YandexMap = (props: YMapProps) => {
disableControls = false,
disableBalloons = false,
areaMargin,
copyrightPosition,
className,
forceAspectRatio = true,
} = props;
Expand Down Expand Up @@ -76,6 +77,7 @@ const YandexMap = (props: YMapProps) => {
autoFitToViewport: 'always',
suppressMapOpenBlock: disableControls,
yandexMapDisablePoiInteractivity: disableControls,
copyrightPosition,
},
),
ref.current,
Expand All @@ -95,6 +97,7 @@ const YandexMap = (props: YMapProps) => {
attemptsIndex,
setLoading,
disableControls,
copyrightPosition,
]);

React.useEffect(() => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/Map/__stories__/Map.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ For a detailed usage guide of the Map component, see [Map Usage](https://github.

`areaMargin?: number | [number, number] | [number, number, number]` - Offset (in pixels) for the marked area of the map relative to the map's container (`30` by default)

`copyrightPosition?: { top?: number; right?: number; bottom?: number; left?: number }` - Position of the copyright text (in pixels)

#### YMapMarker Interface

`address?: string` — Optional string address for the marker
Expand Down
10 changes: 10 additions & 0 deletions src/components/Map/__stories__/Map.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ export const YMapHiddenControls = YMapTemplate.bind({});
export const YMapHiddenBalloons = YMapTemplate.bind({});
export const YMapCustomMarkers = YMapTemplate.bind({});
export const YMapAreaOffset = YMapTemplate.bind({});
export const YMapCopyrightPosition = YMapTemplate.bind({});

YMapHiddenControls.storyName = 'Y Map (Hidden Controls)';
YMapHiddenBalloons.storyName = 'Y Map (Hidden Balloons)';
YMapCustomMarkers.storyName = 'Y Map (Custom Markers)';
YMapAreaOffset.storyName = 'Y Map (Area Margin)';
YMapCopyrightPosition.storyName = 'Y Map (Copyright Position)';

GoogleMap.args = data.gmap;
YMap.args = data.ymap as MapProps;
Expand All @@ -71,3 +73,11 @@ YMapAreaOffset.args = {
...data.ymap,
areaMargin: [0, 0, 0, 200],
} as MapProps;

YMapCopyrightPosition.args = {
...data.ymap,
copyrightPosition: {
top: 150,
right: 250,
},
} as MapProps;
2 changes: 1 addition & 1 deletion src/models/constructor-items/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export interface MediaBlockProps extends MediaBaseBlockProps, WithBorder {
}

export interface MapBlockProps extends MediaBaseBlockProps, WithBorder {
map: Omit<MapProps, 'forceAspectRatio' | 'areaOffset'>;
map: Omit<MapProps, 'forceAspectRatio' | 'areaMargin' | 'copyrightPosition'>;
}

export interface InfoBlockProps {
Expand Down
8 changes: 8 additions & 0 deletions src/models/constructor-items/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,19 @@ export type YMapMargin =
| [vertical: number, horizontal: number]
| [top: number, right: number, bottom: number, left: number];

export interface YMapCopyrightPosition {
top?: number;
right?: number;
bottom?: number;
left?: number;
}

export interface YMapProps extends MapBaseProps {
markers: YMapMarker[];
disableControls?: boolean;
disableBalloons?: boolean;
areaMargin?: YMapMargin;
copyrightPosition?: YMapCopyrightPosition;
id: string;
}

Expand Down