aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/MapBox/MapPushpinBox.tsx
blob: fc5b4dd185fba560198304b8a0a8ed054e3995c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import * as React from 'react';
import { ViewBoxBaseComponent } from '../../DocComponent';
import { FieldView, FieldViewProps } from '../FieldView';
import { MapBox } from './MapBox';

/**
 * Map Pushpin doc class
 */
export class MapPushpinBox extends ViewBoxBaseComponent<FieldViewProps>() {
    public static LayoutString(fieldKey: string) {
        return FieldView.LayoutString(MapPushpinBox, fieldKey);
    }
    componentDidMount() {
        this.mapBoxView.addPushpin(this.Document);
    }
    componentWillUnmount() {
        this.mapBoxView.deletePushpin(this.Document);
    }

    get mapBoxView() {
        return this.DocumentView?.()?.containerViewPath?.().lastElement()?.ComponentView as MapBox;
    }
    get mapBox() {
        return this.DocumentView?.().containerViewPath?.().lastElement()?.Document;
    }

    render() {
        return <div />;
    }
}