aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/MapBox/MapPushpinBox.tsx
blob: 8760c8600d241a0c03586024690cdf1d276ccc4a (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.props.DocumentView?.()?._props.docViewPath().lastElement()?.ComponentView as MapBox;
    }
    get mapBox() {
        return this.props.DocumentView?.()._props.docViewPath().lastElement()?.Document;
    }

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