UNPKG

keystone

Version:

Web Application Framework and Admin GUI / Content Management System built on Express.js and Mongoose

33 lines (28 loc) 885 B
import React from 'react'; import CloudinaryImageSummary from '../../components/columns/CloudinaryImageSummary'; import ItemsTableCell from '../../components/ItemsTableCell'; import ItemsTableValue from '../../components/ItemsTableValue'; var CloudinaryImageColumn = React.createClass({ displayName: 'CloudinaryImageColumn', propTypes: { col: React.PropTypes.object, data: React.PropTypes.object, }, renderValue: function () { var value = this.props.data.fields[this.props.col.path]; if (!value || !Object.keys(value).length) return; return ( <ItemsTableValue field={this.props.col.type}> <CloudinaryImageSummary label="dimensions" image={value} secure={this.props.col.field.secure} /> </ItemsTableValue> ); }, render () { return ( <ItemsTableCell> {this.renderValue()} </ItemsTableCell> ); }, }); module.exports = CloudinaryImageColumn;