keystone
Version:
Web Application Framework and Admin GUI / Content Management System built on Express.js and Mongoose
25 lines (21 loc) • 754 B
JavaScript
import React from 'react';
import ItemsTableCell from '../../components/ItemsTableCell';
import ItemsTableValue from '../../components/ItemsTableValue';
var LocalFileColumn = React.createClass({
renderValue: function () {
var value = this.props.data.fields[this.props.col.path];
if (!value || !value.filename) return;
return value.filename;
},
render: function () {
var value = this.props.data.fields[this.props.col.path];
var href = value && value.url ? value.url : null;
var label = value && value.filename ? value.filename : null;
return (
<ItemsTableCell href={href} padded interior field={this.props.col.type}>
<ItemsTableValue>{label}</ItemsTableValue>
</ItemsTableCell>
);
},
});
module.exports = LocalFileColumn;