2016-09-30 16:25:15 +02:00
|
|
|
import React, { PropTypes } from 'react';
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
|
2016-09-30 16:38:10 +02:00
|
|
|
export default function Preview({ collection, widgetFor }) {
|
|
|
|
if (!collection) {
|
|
|
|
return null;
|
2016-09-30 16:25:15 +02:00
|
|
|
}
|
|
|
|
|
2016-09-30 16:38:10 +02:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
{collection.get('fields').map(field => widgetFor(field.get('name')))}
|
|
|
|
</div>
|
|
|
|
);
|
2016-09-30 16:25:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Preview.propTypes = {
|
|
|
|
collection: ImmutablePropTypes.map.isRequired,
|
|
|
|
entry: ImmutablePropTypes.map.isRequired,
|
|
|
|
getMedia: PropTypes.func.isRequired,
|
2016-09-30 16:38:10 +02:00
|
|
|
widgetFor: PropTypes.func.isRequired,
|
2016-09-30 16:25:15 +02:00
|
|
|
};
|