web-apps/apps/spreadsheeteditor/mobile/src/controller/add/AddShape.jsx
2021-02-04 15:29:33 +03:00

35 lines
830 B
JavaScript

import React, {Component} from 'react';
import { f7 } from 'framework7-react';
import {Device} from '../../../../../common/mobile/utils/device';
import AddShape from '../../view/add/AddShape';
class AddShapeController extends Component {
constructor (props) {
super(props);
this.onShapeClick = this.onShapeClick.bind(this);
}
closeModal () {
if ( Device.phone ) {
f7.sheet.close('.add-popup', true);
} else {
f7.popover.close('#add-popover');
}
}
onShapeClick (type) {
const api = Common.EditorApi.get();
api.asc_addShapeOnSheet(type);
this.closeModal();
}
render () {
return (
<AddShape onShapeClick={this.onShapeClick}
/>
)
}
}
export default AddShapeController;