static-cms/src/containers/EntryPage.js

22 lines
583 B
JavaScript
Raw Normal View History

import React from 'react';
import { connect } from 'react-redux';
2016-05-30 16:55:32 -07:00
import { Map } from 'immutable';
import EntryEditor from '../components/EntryEditor';
2016-05-30 17:08:30 -07:00
class EntryPage extends React.Component {
render() {
const { collection, entry } = this.props;
2016-05-30 16:55:32 -07:00
return <EntryEditor entry={entry || new Map()} collection={collection}/>;
}
}
function mapStateToProps(state, ownProps) {
2016-05-30 17:13:40 -07:00
const { collections, media } = state;
2016-05-30 16:55:32 -07:00
const collection = collections.get(ownProps.params.name);
2016-05-30 17:13:40 -07:00
return {media, collection, collections};
}
2016-05-30 17:08:30 -07:00
export default connect(mapStateToProps)(EntryPage);