[DE mobile] Added the ability to add shapes

This commit is contained in:
JuliaSvinareva 2021-01-20 20:59:19 +03:00
parent f3c4af7914
commit e8f2c61f83
3 changed files with 40 additions and 12 deletions

View file

@ -337,7 +337,7 @@
}
}
.dataview, #add-table {
.dataview, #add-table, #add-shape {
&.page-content {
background-color: @white;
}

View file

@ -1,17 +1,32 @@
import React, {Component} from 'react';
import { f7 } from 'framework7-react';
import {Device} from '../../../../../common/mobile/utils/device';
import {observer, inject} from "mobx-react";
import { AddShape } from '../../view/add/AddShape';
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.AddShapeOnCurrentPage(type);
this.closeModal();
}
render () {
return (
<AddShape
<AddShape onShapeClick={this.onShapeClick}
/>
)
}

View file

@ -1,15 +1,28 @@
import React, {Fragment, useState} from 'react';
import React from 'react';
import {observer, inject} from "mobx-react";
import {Page, Navbar, List, ListItem, ListButton, Row, BlockTitle, Range, Toggle, Icon} from 'framework7-react';
import { useTranslation } from 'react-i18next';
import {Device} from '../../../../../common/mobile/utils/device';
const AddShape = props => {
const storeShapeSettings = props.storeShapeSettings;
let shapes = storeShapeSettings.getStyleGroups();
return (
<Fragment>
</Fragment>
<div className={'dataview shapes'}>
{shapes.map((row, indexRow) => {
return (
<ul className="row" key={'shape-row-' + indexRow}>
{row.map((shape, index) => {
return (
<li key={'shape-' + indexRow + '-' + index} onClick={() => {props.onShapeClick(shape.type)}}>
<div className="thumb"
style={{WebkitMaskImage: `url('resources/img/shapes/${shape.thumb}')`}}>
</div>
</li>
)
})}
</ul>
)
})}
</div>
)
};
export {AddShape};
export default inject("storeShapeSettings")(observer(AddShape));