static-cms/src/components/EntryEditor.js

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-05-30 16:55:32 -07:00
import React from 'react';
import ControlPane from './ControlPane';
import PreviewPane from './PreviewPane';
export default class EntryEditor extends React.Component {
2016-05-30 16:55:32 -07:00
render() {
2016-06-10 14:01:14 -03:00
const { collection, entry, getMedia, onChange, onAddMedia, onRemoveMedia, onPersist } = this.props;
2016-05-30 16:55:32 -07:00
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}
2016-06-10 00:16:01 -03:00
getMedia={getMedia}
onChange={onChange}
onAddMedia={onAddMedia}
2016-06-10 14:01:14 -03:00
onRemoveMedia={onRemoveMedia}
/>
2016-05-30 16:55:32 -07:00
</div>
<div className="cms-preview-pane" style={styles.pane}>
2016-06-10 00:16:01 -03:00
<PreviewPane collection={collection} entry={entry} getMedia={getMedia} />
2016-05-30 16:55:32 -07:00
</div>
</div>
<button onClick={onPersist}>Save</button>
2016-05-30 17:13:40 -07:00
</div>;
2016-05-30 16:55:32 -07:00
}
}
const styles = {
container: {
display: 'flex'
},
pane: {
width: '50%'
}
};