Skip to content

Commit

Permalink
Added OpenlayersMap
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed Aug 21, 2020
1 parent 581288f commit 1ad1bb2
Show file tree
Hide file tree
Showing 3 changed files with 1,292 additions and 0 deletions.
59 changes: 59 additions & 0 deletions src/components/manage/Blocks/DiscodataOpenlayersMapBlock/Edit.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React, { useState, useEffect } from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';
import _uniqueId from 'lodash/uniqueId';
import RenderFields from 'volto-addons/Widgets/RenderFields';
import View from './View';
import { settings } from '~/config';

const getSchema = props => {
return {
draggable: {
type: 'boolean',
title: 'Drraggable',
defaultValue: false,
},
hasPopups: {
type: 'boolean',
title: 'Has popups',
defaultValue: false,
},
hasSidebar: {
type: 'boolean',
title: 'Has sidebar',
defaultValue: false,
},
};
};

const Edit = props => {
const [state, setState] = useState({
schema: getSchema({ ...props, providerUrl: settings.providerUrl }),
id: _uniqueId('block_'),
});
useEffect(() => {
setState({
...state,
schema: getSchema({
...props,
}),
});
/* eslint-disable-next-line */
}, [props.data.isExpandable])
return (
<div>
<RenderFields
schema={state.schema}
{...props}
title="Discodata openlayers map"
/>
<View {...props} id={state.id} />
</div>
);
};

export default compose(
connect((state, props) => ({
pathname: state.router.location.pathname,
})),
)(Edit);
Loading

0 comments on commit 1ad1bb2

Please sign in to comment.