Skip to content

Commit 81e0dfb

Browse files
authored
feat(Ymap): copyright position (#1311)
1 parent a2c9908 commit 81e0dfb

File tree

7 files changed

+28
-2
lines changed

7 files changed

+28
-2
lines changed

memory-bank/usage/map.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ graph TD
7575
- `forceAspectRatio`: Optional boolean to force aspect ratio (16:9 for Desktop, 4:3 for Mobile), `true` by default (inherited from MapBaseProps)
7676
- `disableControls`: Optional boolean to hide map controls (Yandex Maps only), `false` by default
7777
- `disableBalloons`: Optional boolean to disable info balloons (Yandex Maps only), `false` by default
78-
- `areaMargin:` - Optional offset (in pixels) for the marked area of the map relative to the map's container (`30` by default)
78+
- `areaMargin:`: Optional offset (in pixels) for the marked area of the map relative to the map's container (`30` by default)
79+
- `copyrightPosition`: Optional position of the copyright text (in pixels)
7980

8081
#### MapBaseProps (Common Props)
8182

src/components/Map/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Map
1616

1717
`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
1818

19+
`copyrightPosition?: { top?: number; right?: number; bottom?: number; left?: number }` - Position of the copyright text (in pixels). Only for `Yandex maps`
20+
1921
`markers?: object[]` - Description for placemarkers. You need to use it for `Yandex maps`. Specify the parameters given below.
2022

2123
- `address?: string` — Place name, address

src/components/Map/YMap/YandexMap.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const YandexMap = (props: YMapProps) => {
3636
disableControls = false,
3737
disableBalloons = false,
3838
areaMargin,
39+
copyrightPosition,
3940
className,
4041
forceAspectRatio = true,
4142
} = props;
@@ -76,6 +77,7 @@ const YandexMap = (props: YMapProps) => {
7677
autoFitToViewport: 'always',
7778
suppressMapOpenBlock: disableControls,
7879
yandexMapDisablePoiInteractivity: disableControls,
80+
copyrightPosition,
7981
},
8082
),
8183
ref.current,
@@ -95,6 +97,7 @@ const YandexMap = (props: YMapProps) => {
9597
attemptsIndex,
9698
setLoading,
9799
disableControls,
100+
copyrightPosition,
98101
]);
99102

100103
React.useEffect(() => {

src/components/Map/__stories__/Map.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ For a detailed usage guide of the Map component, see [Map Usage](https://github.
3636

3737
`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)
3838

39+
`copyrightPosition?: { top?: number; right?: number; bottom?: number; left?: number }` - Position of the copyright text (in pixels)
40+
3941
#### YMapMarker Interface
4042

4143
`address?: string` — Optional string address for the marker

src/components/Map/__stories__/Map.stories.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ export const YMapHiddenControls = YMapTemplate.bind({});
4646
export const YMapHiddenBalloons = YMapTemplate.bind({});
4747
export const YMapCustomMarkers = YMapTemplate.bind({});
4848
export const YMapAreaOffset = YMapTemplate.bind({});
49+
export const YMapCopyrightPosition = YMapTemplate.bind({});
4950

5051
YMapHiddenControls.storyName = 'Y Map (Hidden Controls)';
5152
YMapHiddenBalloons.storyName = 'Y Map (Hidden Balloons)';
5253
YMapCustomMarkers.storyName = 'Y Map (Custom Markers)';
5354
YMapAreaOffset.storyName = 'Y Map (Area Margin)';
55+
YMapCopyrightPosition.storyName = 'Y Map (Copyright Position)';
5456

5557
GoogleMap.args = data.gmap;
5658
YMap.args = data.ymap as MapProps;
@@ -71,3 +73,11 @@ YMapAreaOffset.args = {
7173
...data.ymap,
7274
areaMargin: [0, 0, 0, 200],
7375
} as MapProps;
76+
77+
YMapCopyrightPosition.args = {
78+
...data.ymap,
79+
copyrightPosition: {
80+
top: 150,
81+
right: 250,
82+
},
83+
} as MapProps;

src/models/constructor-items/blocks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ export interface MediaBlockProps extends MediaBaseBlockProps, WithBorder {
292292
}
293293

294294
export interface MapBlockProps extends MediaBaseBlockProps, WithBorder {
295-
map: Omit<MapProps, 'forceAspectRatio' | 'areaOffset'>;
295+
map: Omit<MapProps, 'forceAspectRatio' | 'areaMargin' | 'copyrightPosition'>;
296296
}
297297

298298
export interface InfoBlockProps {

src/models/constructor-items/common.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,19 @@ export type YMapMargin =
340340
| [vertical: number, horizontal: number]
341341
| [top: number, right: number, bottom: number, left: number];
342342

343+
export interface YMapCopyrightPosition {
344+
top?: number;
345+
right?: number;
346+
bottom?: number;
347+
left?: number;
348+
}
349+
343350
export interface YMapProps extends MapBaseProps {
344351
markers: YMapMarker[];
345352
disableControls?: boolean;
346353
disableBalloons?: boolean;
347354
areaMargin?: YMapMargin;
355+
copyrightPosition?: YMapCopyrightPosition;
348356
id: string;
349357
}
350358

0 commit comments

Comments
 (0)