2016-06-16 19:20:36 -03:00
|
|
|
import React, { PropTypes } from 'react';
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
2016-05-30 16:55:32 -07:00
|
|
|
import ControlPane from './ControlPane';
|
|
|
|
import PreviewPane from './PreviewPane';
|
|
|
|
|
2016-06-16 19:20:36 -03:00
|
|
|
export default function EntryEditor({ collection, entry, getMedia, onChange, onAddMedia, onRemoveMedia, onPersist }) {
|
|
|
|
return <div>
|
|
|
|
<h1>Entry in {collection.get('label')}</h1>
|
|
|
|
<h2>{entry && entry.get('title')}</h2>
|
|
|
|
<div className="cms-container" style={styles.container}>
|
|
|
|
<div className="cms-control-pane" style={styles.pane}>
|
|
|
|
<ControlPane
|
|
|
|
collection={collection}
|
|
|
|
entry={entry}
|
|
|
|
getMedia={getMedia}
|
|
|
|
onChange={onChange}
|
|
|
|
onAddMedia={onAddMedia}
|
|
|
|
onRemoveMedia={onRemoveMedia}
|
|
|
|
/>
|
2016-05-30 16:55:32 -07:00
|
|
|
</div>
|
2016-06-16 19:20:36 -03:00
|
|
|
<div className="cms-preview-pane" style={styles.pane}>
|
|
|
|
<PreviewPane collection={collection} entry={entry} getMedia={getMedia} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<button onClick={onPersist}>Save</button>
|
|
|
|
</div>;
|
2016-05-30 16:55:32 -07:00
|
|
|
}
|
2016-06-05 01:52:18 -07:00
|
|
|
|
|
|
|
const styles = {
|
|
|
|
container: {
|
|
|
|
display: 'flex'
|
|
|
|
},
|
|
|
|
pane: {
|
|
|
|
width: '50%'
|
|
|
|
}
|
|
|
|
};
|
2016-06-16 19:20:36 -03:00
|
|
|
|
|
|
|
EntryEditor.propTypes = {
|
|
|
|
collection: ImmutablePropTypes.map.isRequired,
|
|
|
|
entry: ImmutablePropTypes.map.isRequired,
|
|
|
|
getMedia: PropTypes.func.isRequired,
|
|
|
|
onAddMedia: PropTypes.func.isRequired,
|
|
|
|
onChange: PropTypes.func.isRequired,
|
|
|
|
onPersist: PropTypes.func.isRequired,
|
|
|
|
onRemoveMedia: PropTypes.func.isRequired,
|
|
|
|
};
|